Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
150882 李朋秦 反转字符串 C++ Compile Error 0 MS 0 KB 223 2026-04-02 09:29:27

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { char *s=new char[101]; memset(s,0,sizeof(char)*101); gets(s); int l=strlen(s); for(int i=0;i<l;i++){ cout<<s[i]; } delete []a; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s);
  ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:46,
                 from Main.cc:1:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.cc:7:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s);
  ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:46,
                 from Main.cc:1:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.cc:7:8: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s);
        ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:46,
                 from Main.cc:1:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.cc:12:11: error: 'a' was not declared in this scope
  delete []a;
           ^
Main.cc:7:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
  gets(s);
         ^