| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 136152 | 张唯一 | 字母概率 | C++ | Compile Error | 0 MS | 0 KB | 312 | 2025-11-09 16:59:06 |
#include<iostream> #include<cstring> 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; }
Main.cc: In function 'int main()':
Main.cc:12: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/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: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/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: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/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:13:11: error: 'strlwr' was not declared in this scope
strlwr (b);
^
Main.cc:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < strlen(b);i++)
^
Main.cc:12:10: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets (b);
^