#include #include using namespace std;

int main() { char str[31]; cin.getline(str, 31, '#'); //输入以#结尾的字符串 int len = strlen(str); for (int i = 0; i < len; i++) { if (str[i] >= 'a' && str[i] <= 'z') { //小写字母转大写字母 str[i] -= 32; } else if (str[i] >= 'A' && str[i] <= 'Z') { //大写字母转小写字母 str[i] += 32; }
} cout << str << endl; return 0; }

C++ 字符串大小写转换程序 - 以#结尾

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

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