Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6396 柯宇希 二维数组的最大值与最小值 C++ Compile Error 0 MS 0 KB 584 2025-02-22 15:24:19

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<limits.h> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n; int a[11][11]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; int _min=a[0][0],_max=a[0][0]; _min=min(_min,a[i][j]) _max=max(_max,a[i][j]) } } cout<<_min<<" "<<_max; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:15: error: expected ';' before '_max'
               _max=max(_max,a[i][j])  
               ^
Main.cc:13:30: warning: unused variable '_max' [-Wunused-variable]
             int _min=a[0][0],_max=a[0][0];
                              ^
Main.cc:20:11: error: '_min' was not declared in this scope
     cout<_min<<" "<<_max;
           ^
Main.cc:20:22: error: '_max' was not declared in this scope
     cout<<_min<<" "<<_max;
                      ^