Quick actions

cmd+k|ctrl+k

Navigation

Languages

LAB7_1080_dop

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-06T17:43:22Z

Updated

2018-12-06T17:43:22Z

#include <iostream>
using namespace std;

int main() {
    const int x = 12 , y = 1 ; 
    int a[x][y] , b[x][y];
    
    for (size_t i = 0 ; i < x ; i++){
        cout << i+1 << " ====\t" ;
        for(size_t j = 0 ; j < y ; j++){
            a[i][j] = rand() % 99 ; 
            cout << a[i][j] << "\t" ; 
        }
        cout << endl ; 
    }
    int x1 = 0 , x2 = 1 , x3 = x ; 
    
    for (size_t i = 0 ; i < x ; i+=2){
        for(size_t j = 0 ; j < y ; j++){
            b[i][j]  = a[x1][j];
        }
        x1++;
    }
    x1=x-1;
    for (size_t i = 1 ; i < x ; i+=2){
        for(size_t j = 0 ; j < y ; j++){
            b[i][j]  = a[x1][j];
        }
        x1--;
    }
    
   
    for (size_t i = 0 ; i < x ; i++){
        for(size_t j = 0 ; j < y ; j++){
            cout << b[i][j] << "\t" ; 
        }
        cout << endl ; 
    }
    
    return 0;
}
INFO