Advertisement
Josif_tepe

Untitled

Dec 18th, 2022
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, m;
  7.     cin >> n >> m;
  8.    
  9.     int mat[n][m];
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             cin >> mat[i][j];
  13.         }
  14.     }
  15.    
  16.     int h, k;
  17.     cin >> h >> k;
  18.    
  19.     for(int j = 0; j < m; j++) {
  20.         swap(mat[h][j], mat[k][j]);
  21.     }
  22.    
  23.     for(int i = 0; i < n; i++) {
  24.         for(int j = 0; j < m; j++) {
  25.             cout << mat[i][j] << " ";
  26.         }
  27.         cout << endl;
  28.     }
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement