#include #include using namespace std;

int main() { char str[31]; cin >> str; int len = strlen(str); for (int i = 0; i < len - 1; i++) { if (str[i] >= 'a' && str[i] <= 'z') { str[i] = str[i] - 'a' + 'A'; // 小写转大写 } else if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = str[i] - 'A' + 'a'; // 大写转小写 } } cout << str << endl; return 0; }

C++ 字符串大小写转换程序:将小写字母转大写,大写字母转小写

原文地址: https://www.cveoy.top/t/topic/mGFH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录