一、
void f7(){
string s1="AAAbbb";
transform(s1.begin(),s1.end(),s1.begin(),toupper);
cout<<"全部转化为大写:"<<s1<<endl;
transform(s1.begin(),s1.end(),s1.begin(),tolower);
cout<<"全部转化为小写:"<<s1<<endl;
}
结果:全部转化为大写:AAABBB;
全部转化为小写:aaabbb;
二、
#include <iostream>
#include <algorithm>
using namespace std;
char op(char ch)
{
if(ch>='A'&&ch<='Z')
return ch+32;
else
return ch;
}
int main()
{
string first,second;
cin>>first;
second.resize(first.size());
transform(first.begin(),first.end(),second.begin(),op);
cout<<second<<endl;
return 0;
}