好用的STL -islower(),isupper(),tolower(),toupper();
其实我是非常不想记这个的,非常的枯燥,但是结合题目就不一样了
2. islower() 判断是不是小写
3. tolower() 转换成小写
4. 需要的头文件 #include<cctype>
5. 要用char 而不是string
暂时只能够想到这么多了</cctype>
#include<iostream>
#include<cctype>
using namespace std;
int main()
{
char s;
while(cin >> s)
{
if(islower(s))
{
char t = toupper(s);
cout << t << endl;
}
else if(isupper(s))
{
char t = tolower(s);
cout << t << endl;
}
}
return 0;
}


京公网安备 11010502036488号