#include<iostream> #include <string> #include <typeinfo> using std::string; using std::cout; using std::cin; using std::endl; int main() { string str{"hello world!!!"}; int count = 0; for ( decltype(str.size()) index = 0; index!=str.size() && !isspace(str[index]); ++index) { str[index] = toupper(str[index]); } cout << str << endl; system("pause"); return 0; }
原文:https://www.cnblogs.com/foremember/p/10505839.html