Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
106182 罗迎甲 矩阵加法 C++ Compile Error 0 MS 0 KB 676 2025-01-15 16:23:59

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 b[100][100]; int c[100][100]; int a[100][100]; int main() { int n,m; cin>>n>>m; for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { cin>>a[i][j]; } } for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { cin>>b[i][j]; } } for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { c[i][j]=a[i][j]+b[i][j]; cout<<c[i][j]<<" "; } cout<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:12: error: a function-definition is not allowed here before '{' token
 int main() { 
            ^
Main.cc:8:9: warning: unused variable 'b' [-Wunused-variable]
     int b[100][100]; 
         ^
Main.cc:9:5: warning: unused variable 'c' [-Wunused-variable]
 int c[100][100]; 
     ^
Main.cc:10:5: warning: unused variable 'a' [-Wunused-variable]
 int a[100][100]; 
     ^
Main.cc:32:1: error: expected '}' at end of input
 }
 ^