Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
2821 邓小龙 二维数组的最大值与最小值 C++ Compile Error 0 MS 0 KB 479 2024-03-02 17:54:49

Tests(0/0):


Code:

#include<iostream> #include<cstdio> using namespace std; int a[9][9],Min=INT_MAX,Max=INT_MIN; int main(){ //输入 int n; cin>>n; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j]; //遍历,寻找最大最小值 for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(a[i][j]>Max) Max=a[i][j]; if(a[i][j]<Min) Min=a[i][j]; } } cout<<Min<<" "<<Max<<endl; return 0; }


Run Info:

Main.cc:4:17: error: 'INT_MAX' was not declared in this scope
 int a[9][9],Min=INT_MAX,Max=INT_MIN;
                 ^
Main.cc: In function 'int main()':
Main.cc:15:24: error: 'Max' was not declared in this scope
             if(a[i][j]>Max) Max=a[i][j];
                        ^
Main.cc:19:21: error: 'Max' was not declared in this scope
     cout<Min<<" "<<Max<<endl;
                     ^