Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
117175 胡海峰老师 求最大值 C++ Compile Error 0 MS 0 KB 313 2025-04-13 20:52:25

Tests(0/0):


Code:

#include <iostream> using namespace std; int main(){ int n[10+3]; // a[0]不用!!!, a[1],a[2],a[3],-a[9],a[10] for (int i = 1;i <= 10;i++){ cin>>n[i]; } int max = a[1]; for (int i = 2;i <= 10;i++){ if (n[i] > max){ max = n[i]; } } cout<<max; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:12: error: 'a' was not declared in this scope
  int max = a[1];
            ^