Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
5256 | 李宇轩 | 二维数组的最大值与最小值 | C++ | Compile Error | 0 MS | 0 KB | 521 | 2024-11-09 12:49:35 |
#include <stdio.h> int main(void){ int arr[10],n,max,maxIndex; scanf("%d",&n); if(n>1&&n<10){ for(int i=0;i<n;i++){ scanf("%d",&arr[i]); if(i==0){ max=arr[i]; maxIndex=i; }else{ if(arr[i]>max){ - max=arr[i]; maxIndex=i; } } } printf("%d %d",max,maxIndex); } return 0; }
Main.cc: In function 'int main()': Main.cc:13:24: error: lvalue required as left operand of assignment max=arr[i]; ^