#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string str = "ancdANDG";
cout << "转换前的字符串: " << str << endl;
for(auto &i : str){
i = toupper(i);//i = tolower(i);
}
cout << "转换后的字符串: " << str << endl;
//或者
for(int i = 0;i < str.size();++i){
str[i] = toupper(s[i]);//str[i] = toupper(s[i]);
}
cout << "转换后的字符串: " << str << endl;
return 0;
}
标签:std,转换,string,C++,大小写,include
From: https://www.cnblogs.com/linhongyu0090/p/17165895.html