小蚂蚁 发表于 2021-12-30 18:56:08

C++矩阵加法



#include <iostream>
using namespace std;

int main(){
int a,b,n,m;
cin >> n >> m;

for (int i = 0;i < n;i ++){
for (int j = 0;j < m;j ++){
cin >> a;
}
}

for (int i = 0;i < n;i ++){
for (int j = 0;j < m;j ++){
cin >> b;
}
}
for (int i = 0;i < n;i ++){
for (int j = 0;j < m;j ++){
cout << a + b << " ";
}
cout << endl;
}
return 0;
}
从下一章起,我的代码将变为紧凑的风格。


https://blog.51cto.com/u_15467636/4864102
页: [1]
查看完整版本: C++矩阵加法