| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80079 | 胡盛哲 | 找最大的数 | C++ | Compile Error | 0 MS | 0 KB | 273 | 2024-07-11 10:56:52 |
#include<bits/stdc++.h> using namespace std; int a[11]; int main; int max; for(int i=1; i<=10 ;i++){ cin >> a[i]; } max = a[1]; int k = i; for(int i=2;i<=10;i++){ if(a[i]>max){ max = a[i]; k = i; } } cout << k; return 0; }
Main.cc:6:5: error: expected unqualified-id before 'for'
for(int i=1; i<=10 ;i++){
^
Main.cc:6:18: error: 'i' does not name a type
for(int i=1; i<=10 ;i++){
^
Main.cc:6:25: error: 'i' does not name a type
for(int i=1; i<=10 ;i++){
^
Main.cc:9:2: error: reference to 'max' is ambiguous
max = a[1];
^
Main.cc:5:9: note: candidates are: int max
int max;
^
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:10: error: 'i' was not declared in this scope
int k = i;
^
Main.cc:11:2: 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:20: error: 'i' does not name a type
for(int i=2;i<=10;i++){
^
Main.cc:17:2: error: 'cout' does not name a type
cout << k;
^
Main.cc:19:2: error: expected unqualified-id before 'return'
return 0;
^
Main.cc:20:1: error: expected declaration before '}' token
}
^