c++string字符串的输出
来源:互联网 发布:mac上有没有hgame 编辑:程序博客网 时间:2024/05/17 07:39
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
string s("some stringh");
//法1:
//if(!s.empty())
//s[0]=toupper(s[0]);
//法2:
//if(s.begin()!=s.end()){
//auto it=s.begin();
//*it=toupper(*it);
//}
//法3:将 some 转换成大写
for(auto it=s.begin();it!=s.end()&&!isspace(*it);it++)
*it=toupper(*it);
cout<<s<<endl;
system("pause");
}
#include<string>
#include<cctype>
using namespace std;
int main()
{
string s("some stringh");
//法1:
//if(!s.empty())
//s[0]=toupper(s[0]);
//法2:
//if(s.begin()!=s.end()){
//auto it=s.begin();
//*it=toupper(*it);
//}
//法3:将 some 转换成大写
for(auto it=s.begin();it!=s.end()&&!isspace(*it);it++)
*it=toupper(*it);
cout<<s<<endl;
system("pause");
}
0 0
- c++string字符串的输出
- String 字符串的倒序输出
- C语言 字符串的输出
- String 反向输出字符串
- C语言字符串函数与C++string的字符串函数
- C语言 - 字符串的输入、输出
- C 字符串的定义,初始化输出
- c语言实现字符串的逆序输出
- C语言的字符串输出puts()函数
- C语言的字符串输出fputs()函数
- C++string类型字符串的存储方式
- 关于C++String字符串的使用
- Reverse String反向输出字符串
- 字符串倒叙输出,StringBuffer,String
- C++实现string类字符串单词的逆序输出
- C#控制台基础 通过string.format输出字符串的实例
- String字符串逆序输出的两种方式
- C++中字符串string的输出,很有意思
- LeetCode题解:Search for a Range
- SQL语句介绍(2)
- 实例成员变量不能在静态方法中访问
- Migrate table to another Oracle Server-01
- 程序1
- c++string字符串的输出
- android volley详解
- hdu 1058
- 文件乱码问题
- Linux系统里的加密压缩方式
- testlink与mantis
- 完美的运用MSComm控件开发串口调试助手
- 将系统中的编码输出到txt文件
- 如何变成有趣的人?