#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");
}