Advertisement
Josif_tepe

Untitled

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