Guest User

Untitled

a guest
Aug 14th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n,m,x,y,vs,a[50][50],i,j;
  9. ifstream f1("1.in");
  10. f1>>n>>m>>x>>y;
  11. for(i=0;i<n;i++)
  12. for(j=0;j<m;j++)
  13. f1>>a[i][j];
  14. f1.close();
  15. for(i=0;i<n;i++)
  16. {
  17. vs=a[i][x-1];
  18. a[i][x-1]=a[i][y-1];
  19. a[i][y-1]=vs;
  20. }
  21. ofstream f2("1.out");
  22. for(i=0;i<n;i++)
  23. {
  24. for(j=0;j<m;j++)
  25. f2<<a[i][j]<<" ";
  26. f2<<endl;
  27. }
  28. f2.close();
  29. return 0;
  30. }
Add Comment
Please, Sign In to add comment