编写一个程序,读取键盘输入,直到遇到@符号为止,并回显输入(数字除外),同时将大写字符改为小写,小写字符改为大写,使用cctype函数系列 。
#include <iostream>
#include<cctype>
int main()
{
using namespace std;
cout << "直到输出@符号停止:\n";
char ch;
cin.get(ch);
while (ch!='@')
{
if (isdigit(ch))
{
cout << "";
}
else if (isupper(ch))
{
ch = tolower(ch);
cout << ch;
}
else if (islower(ch))
{
ch = toupper(ch);;
cout << ch;
}
else
cout << ch;
cin.get(ch);
}
cout << endl;
return 0;
}