| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80084 | 胡盛哲 | 找最大的数 | C++ | Compile Error | 0 MS | 0 KB | 253 | 2024-07-11 10:59:08 |
#include<bits/stdc++.h> using namespace std; int a[11]; int main; int max,k; for(int i=1; i<=10 ; i++) { cin >> a[i]; } max = a[1]; k = 1; for(int i=2; i<=10; i++) { if(a[i]>max) { max = a[i]; k = i; } } cout << k; return 0; }
Main.cc:6:1: error: expected unqualified-id before 'for'
for(int i=1; i<=10 ; i++) {
^
Main.cc:6:14: error: 'i' does not name a type
for(int i=1; i<=10 ; i++) {
^
Main.cc:6:22: error: 'i' does not name a type
for(int i=1; i<=10 ; i++) {
^
Main.cc:9:1: error: reference to 'max' is ambiguous
max = a[1];
^
Main.cc:5:5: note: candidates are: int max
int max,k;
^
In file included from /usr/include/c++/5/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
from Main.cc:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note: template _Tp std::max(std::initializer_list<_Tp>, _Compare)
max(initializer_list<_Tp> __l, _Compare __comp)
^
/usr/include/c++/5/bits/stl_algo.h:3457:5: note: template _Tp std::max(std::initializer_list<_Tp>)
max(initializer_list<_Tp> __l)
^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
from /usr/include/c++/5/ios:40,
from /usr/include/c++/5/istream:38,
from /usr/include/c++/5/sstream:38,
from /usr/include/c++/5/complex:45,
from /usr/include/c++/5/ccomplex:38,
from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
from Main.cc:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note: template const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: template const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^
Main.cc:10:1: error: 'k' does not name a type
k = 1;
^
Main.cc:11:1: error: expected unqualified-id before 'for'
for(int i=2; i<=10; i++) {
^
Main.cc:11:14: error: 'i' does not name a type
for(int i=2; i<=10; i++) {
^
Main.cc:11:21: error: 'i' does not name a type
for(int i=2; i<=10; i++) {
^
Main.cc:17:1: error: 'cout' does not name a type
cout << k;
^
Main.cc:19:1: error: expected unqualified-id before 'return'
return 0;
^
Main.cc:20:1: error: expected declaration before '}' token
}
^