{"title":"题目描述","content":"大家都知道一些办公软件有自动将字母转换为大写的功能。输入一个长度不超过 100100 且不包括空格的字符串。要求将该字符串中的所有小写字母变成大写字母并输出。\n\n输入格式\n输入一行,一个字符串。\n\n输出格式\n输出一个字符串,即将原字符串中的所有小写字母转化为大写字母。\n\n输入输出样例\n输入 #1复制\nLuogu4!\n输出 #1复制\nLUOGU4!\nc++内容:#include \n#include \nusing namespace std;\n\nint main() {\n string str;\n cin >> str;\n \n for (int i = 0; i < str.length(); i++) {\n if (islower(str[i])) {\n str[i] = toupper(str[i]);\n }\n }\n \n cout << str << endl;\n \n return 0;\n}

C++ 字符串大小写转换 - 将小写字母转换为大写字母

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

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