Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136151 郑喆哲 字母概率 C++ Compile Error 0 MS 0 KB 296 2025-11-09 16:58:52

Tests(0/0):


Code:

#include<iostream> #include<cstring> using namespace std; int main() { char a; char s1[201]; double d; double e=0; cin>>a; gets(s1); strlwr(s1); for(int c=0;c<strlen(s1);c++) { if(s1[c]==a) { e+=1; } } d=e/(strlen(s1)-1); printf("%.5lf",d); return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s1);
  ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/c++/5/ext/string_conversions.h:43,
                 from /usr/include/c++/5/bits/basic_string.h:5249,
                 from /usr/include/c++/5/string:52,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from Main.cc:1:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.cc:11:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s1);
  ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/c++/5/ext/string_conversions.h:43,
                 from /usr/include/c++/5/bits/basic_string.h:5249,
                 from /usr/include/c++/5/string:52,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from Main.cc:1:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.cc:11:9: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(s1);
         ^
In file included from /usr/include/c++/5/cstdio:42:0,
                 from /usr/include/c++/5/ext/string_conversions.h:43,
                 from /usr/include/c++/5/bits/basic_string.h:5249,
                 from /usr/include/c++/5/string:52,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 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: 'strlwr' was not declared in this scope
  strlwr(s1);
           ^
Main.cc:13:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int c=0;c