| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 157603 | 汪明轩 | 统计数字字符个数 | C++ | Compile Error | 0 MS | 0 KB | 256 | 2026-08-04 14:25:09 |
#include<iostream> #include<cstring> char a[260] using namespace std; int main(){ gets(a); int s=0; int len=strlen(a); for(int i=0;i<len;i++){ if(a[i]>='0'&&a[i]<='9'){ s++; } } cout<<s; return 0; }
Main.cc:4:1: error: expected initializer before 'using'
using namespace std;
^
Main.cc: In function 'int main()':
Main.cc:6:5: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(a);
^
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:6:5: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(a);
^
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:6:10: error: 'a' was not declared in this scope
gets(a);
^
Main.cc:14:2: error: 'cout' was not declared in this scope
cout<