Quick actions

cmd+k|ctrl+k

Navigation

Languages

Lab 7(1)

Snippet info

Language

Cpp

Visibility

public

Author

diety

Created

2018-12-21T05:33:58Z

Updated

2018-12-21T05:33:58Z

#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] = i ; 
            cout << a[i][j] << "  " ;
        }
        cout << endl ; 
    }
    
    int k , x = (n-1)  , y = 0 ; 
    for ( size_t i = 0 ; i <= n/2-1; i++){
        for ( size_t j = 0 ; j < n ; j++){
            k = a[i][j];
            a[i][j] = a[x][y];
            a[x][y] = k ;
            y = y + 1 ; 
        }
         x = x - 1 ; 
         y = 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