Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
105740 糜宗易 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 255 2025-01-14 11:52:27

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int a; cin>>a; int b[a],d=0,e=10000; for(int i=0;i<a;i++){ cin>>b[i]; } for(int c=0;c<a;c++) {if(b[i]>d) d=b[i]; if(b[i]<e) e=b[i]; } cout<<d-e; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:11: error: 'i' was not declared in this scope
     {if(b[i]>d) d=b[i];
           ^
Main.cc:12:10: error: 'i' was not declared in this scope
     if(b[i]