//两个矩阵的乘积之和
#include <iostream> using namespace std; int main() { int a[5][5],b[5][5],sum = 0; for(int i = 0;i<5;i++){ for(int j = 0;j<5;j++){ cin>>a[i][j]; } } for(int i = 0;i<5;i++){ for(int j = 0;j<5;j++){ cin>>b[i][j]; } } for(int i = 0;i<5;i++){ for(int j = 0;j<5;j++){ sum += a[i][j]*b[i][j]; } } cout<<sum; return 0; } /*
矩阵交换 #include <iostream> using namespace std; int main() { int a[5][5],n,m; for(int i = 0;i<5;i++){ for(int j = 0;j<5;j++){ cin>>a[i][j]; } } cin>>n>>m; n--;m--; for(int i = 0;i<5;i++){ swap(a[n][i],a[m][i]); } for(int i = 0;i<5;i++){ for(int j = 0;j<5;j++){ cout<<a[i][j]<<" "; } cout<<endl; } return 0; }*/
标签:std,int,namespace,--,二维,数组,using,main From: https://www.cnblogs.com/wangyihang-xh/p/17455242.html