Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136604 刘梓含 找最大的数 C++ Compile Error 0 MS 0 KB 278 2025-11-15 14:28:07

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main (){ int a[11]; int max,n; for(int i = 1;i <= 10;i++) { cin >> a[i]; } max = a[1]; for(int i = 2;i <= 10;i++) { if(a[i] > max) { max = a[i]; x = i; } } cout << x; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:18:4: error: 'x' was not declared in this scope
    x = i;
    ^
Main.cc:21:10: error: 'x' was not declared in this scope
  cout << x;
          ^
Main.cc:7:10: warning: unused variable 'n' [-Wunused-variable]
  int max,n;
          ^