Quick actions

cmd+k|ctrl+k

Navigation

Languages

LAB7_1059

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-11-29T06:53:04Z

Updated

2018-12-03T17:47:25Z

#include <iostream>
using namespace std;



int main() {
    const int n = 6 ; 
    int a[n][n];
    for ( size_t i = 0 ; i <n ; i++){
        for ( size_t j = 0 ; j < n ; j++){
            a[i][j] = j; 
            cout << a[i][j] << "  " ;
        }
        cout << endl ; 
    }
    
    int k , x = 0  , y = n-1 ; 
    
    for ( size_t j = 0 ; j <= n/2-1 ; j++){
        for ( size_t i = 0 ; i < n ; i++){
        
             k = a[i][j];
             a[i][j] = a[x][y];
             a[x][y] = k ;
             x = x + 1  ;
         }
         y = y - 1  ;
         x=0;
    }
    
    
   cout << "----------" << endl ; 

    
     for ( size_t i = 0 ; i <n ; i++){
        for ( size_t j = 0 ; j < n ; j++){
            cout << a[i][j] << "  " ;
        }
        cout << endl ; 
    }
    
    
    
    
    return 0;
}
INFO