f0706.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //=====================================
- // f0707.cpp
- //=====================================
- #include<iostream>
- #include<iomanip>
- #include<fstream>
- using namespace std;
- //-------------------------------------
- const int row=100;
- const int col=100;
- int main(){
- ifstream in("ab.txt");
- int ma[row][col];
- int mb[row][col];
- int mc[row][col];
- for(int r,c; in>>r>>c; ){
- for(int i=0; i<r; ++i)
- for(int j=0; j<c; ++j)
- in>>ma[i][j];
- for(int i=0; i<r; ++i)
- for(int j=0; j<c; ++j)
- in>>mb[i][j];
- for(int i=0; i<r; ++i)
- for(int j=0; j<c; ++j)
- mc[i][j] = ma[i][j] + mb[i][j];
- for(int i=0; i<r; ++i){
- for(int j=0; j<c; ++j)
- cout<<setw(4)<<mc[i][j];
- cout<<endl;
- }
- }
- }//====================================