Quick actions

cmd+k|ctrl+k

Navigation

Languages

LAB7_1078_dop

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-06T17:18:58Z

Updated

2018-12-06T17:18:58Z

#include <iostream>
using namespace std;

int main() {
    
    const int x = 20 , y = 7 ; 
    int a[x][y] , b[x][y],c[x][y];
    for (size_t i = 0 ; i < x ; i++){
        for (size_t j = 0 ; j < y ; j++){
            a[i][j] = rand() % 90 ; 
            cout << a[i][j] << "\t";
        }
        cout << endl ; 
    }
    
    cout << "Введите кол. строк k:" << endl ; 
    int k ; 
    cin >> k ; 
    int x1 = k  ; 
    for (size_t i = 0 ; i < x ; i++){
        for(size_t j = 0 ; j < y ; j++){
            b[i][j] = a[x1][j] ; 
        }
        x1++;
    }
    x1 = 0 ; 
    for (size_t i = x-k ; i < x ; i++){
        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