编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#2263 #1001. 中心字母 Compile Error 0 0 ms 0 K C++ 17 / 148 B s230026114 2023-11-17 1:47:09
显示原始代码
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
    char a[100];
    scanf("%s", a);
    printf("%c", a[(strlen(a) + 1) / 2 - 1]);
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:8:17: error: 'strlen' was not declared in this scope
    8 |  printf("%c",a[(strlen(a)+1)/2-1]);
      |                 ^~~~~~
/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 | #include<stdio.h>
/sandbox/1/a.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%s",a);
      |  ~~~~~^~~~~~~~