Run ID:109093

提交时间:2025-01-26 16:24:40

#include <iostream> #include <string> #include <cctype> // 用于字符操作 using namespace std; // 检查是否为元音字母 bool isVowel(char c) { c = tolower(c); // 转换为小写进行判断 return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } int main() { int T; cin >> T; // 读取测试数据个数 cin.ignore(); // 忽略换行符,确保下一次读取时从第一组数据开始 while (T--) { string s; getline(cin, s); // 读取字符串 // 遍历字符串并进行转换 for (char &c : s) { if (isVowel(c)) { c = toupper(c); // 元音字母转为大写 } else { c = tolower(c); // 其余字母转为小写 } } cout << s << endl; // 输出结果 } return 0; }