编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#2422 #1001. 中心字母 Compile Error 0 0 ms 0 K C++ 17 / 188 B t330026054 2023-11-17 15:26:02
显示原始代码
#include <iostream>
using namespace std;

int main() {
    char str[101];
    int recorder = 0;
    cin.getline(str, 101);
    recorder = strlen(str);
    cout << str[recorder / 2];
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:9:11: error: 'strlen' was not declared in this scope
    9 |  recorder=strlen(str);
      |           ^~~~~~
/sandbox/1/a.cpp:2:1: note: 'strlen' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;