Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- int n,m,x,y,vs,a[50][50],i,j;
- ifstream f1("1.in");
- f1>>n>>m>>x>>y;
- for(i=0;i<n;i++)
- for(j=0;j<m;j++)
- f1>>a[i][j];
- f1.close();
- for(i=0;i<n;i++)
- {
- vs=a[i][x-1];
- a[i][x-1]=a[i][y-1];
- a[i][y-1]=vs;
- }
- ofstream f2("1.out");
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- f2<<a[i][j]<<" ";
- f2<<endl;
- }
- f2.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment