64,642
社区成员
发帖
与我相关
我的任务
分享
std::string str="abc";
...
std::cout<<str<<std::endl;//输出ABC
int main(){
string str="abc";
boost::to_upper(str);
cout<<str;
}
ABC请按任意键继续. . .
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s = "Taking";
// toUpper
transform(s.begin(), s.end(), s.begin(), toupper);
// toLower
// transform(s.begin(),s.end(),s.begin(),tolower);
cout << s << endl;
}
//我2楼贴的那个有问题,看这个
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void main()
{
string str="abc";
transform(str.begin(),str.end(),str.begin(),toupper);
cout<<str<<endl;
}
#include <iostream>
#include <string>
using namespace std;
void main()
{
string str="abc";
cout<<toupper(str.c_str());
}