Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136158 张唯一 字母概率 C++ Compile Error 0 MS 0 KB 298 2025-11-09 17:01:05

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { char a; double s; double n; n = 0; char b[201]; cin >> a; gets (b); strlwr (b); for(int i = 0;i < strlen(b);i++) { if(a == b[i]) { n++; } } s = n / (strlen(b) - 1); printf("%.5lf",s); return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets (b);
  ^
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:11:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets (b);
  ^
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:11:9: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets (b);
         ^
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: 'strlwr' was not declared in this scope
  strlwr (b);
           ^
Main.cc:13:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i < strlen(b);i++)
                  ^
Main.cc:11:10: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
  gets (b);
          ^