Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
114520 彭士宝 输出元音字母 C++ Accepted 1 MS 272 KB 752 2025-03-22 14:36:36

Tests(1/1):


Code:

#include <iostream> #include <string> using namespace std; // 函数:将字符串中的元音字母复制到另一个字符串 string copyVowels(const string& str) { string vowels = "aeiouAEIOU"; // 包含所有元音字母 string result = ""; // 用于存储元音字母的字符串 for (char c : str) { if (vowels.find(c) != string::npos) { // 如果字符是元音字母 result += c; // 将其添加到结果字符串中 } } return result; } int main() { string input; getline(cin, input); // 读取包含空格的字符串 string output = copyVowels(input); // 调用函数获取元音字母字符串 cout << output << endl; // 输出结果 return 0; }