Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133073 黄枳润 删除单词后缀 C++ Compile Error 0 MS 0 KB 382 2025-10-13 20:33:12

Tests(0/0):


Code:

#include <iostream> #include <string> int main() { int n; std::cin >> n; std::cin.ignore(); // 忽略换行符 for (int i = 0; i < n; i++) { std::string name; std::getline(std::cin, name); // 将第一个字符大写, 其他字符小写 name[0] = toupper(name[0]); for (int j = 1; j < name.length(); j++) { name[j] = tolower(name[j]); } std::cout << name << std::endl; } return 0; }


Run Info:

Main.cc:1:21: warning: extra tokens at end of #include directive
 #include  #include  int main() { int n; std::cin >> n; std::cin.ignore(); // 忽略换行符 for (int i = 0; i < n; i++) { std::string name; std::getline(std::cin, name); // 将第一个字符大写, 其他字符小写 name[0] = toupper(name[0]); for (int j = 1; j < name.length(); j++) { name[j] = tolower(name[j]); } std::cout << name << std::endl; } return 0; }
                     ^
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status