编写一个程序,读取键盘输入,直到遇到@符号为止,并回显输入(数字除外),同时将大写字符转换为小写,将小写字符转换为大写(别忘了cctype函数系列)

来源:互联网 发布:女娲 知乎 编辑:程序博客网 时间:2024/05/21 17:25
#include <iostream>#include <cctype>using namespace std;int main(){        cout << "Enter text for analysis, and type @ to terminate input.\n";        char ch;        while(ch != '@')        {                if(islower(ch))                {                        ch = toupper(ch);                }                else if(isupper(ch))                {                        ch = tolower(ch);                }                if(isdigit(ch) == false)                {                        cout << ch;                }                cin.get(ch);        }        cout << endl;        return 0;}

1 0