Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
105249 吴诗涵 矩阵对角线 C++ Compile Error 0 MS 0 KB 568 2025-01-12 18:52:25

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int m,n; cin>>n>>m; int a[n][m],b=0,c=m; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; if(i==j||i+j=n+1){ a[i][j]+=m; } } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ printf("%5d",a[i][j]); } cout<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:21: error: lvalue required as left operand of assignment
         if(i==j||i+j=n+1){
                     ^
Main.cc:10:13: warning: unused variable 'b' [-Wunused-variable]
 int a[n][m],b=0,c=m;
             ^
Main.cc:10:17: warning: unused variable 'c' [-Wunused-variable]
 int a[n][m],b=0,c=m;
                 ^