Quick actions

cmd+k|ctrl+k

Navigation

Languages

Динам.Многомер. Масс. + srand

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-23T17:33:07Z

Updated

2018-12-23T17:33:07Z

#include <iostream>
using namespace std;
#include <ctime>


int main() {
    
    srand(time(NULL));
    
    int rows = 6 , cols = 6 ; 
    
    int **arr  = new int* [rows];
    
    for (size_t i = 0 ; i < rows ; i++){
        arr[i] = new int [cols];
    } 
    
    //////////////////////////////
    
    for (size_t i = 0 ; i < rows ; i++){
        for (size_t j = 0 ; j < cols ; j++){
            arr[i][j] = rand () % 100 ; 
            if (arr[i][j] > 10){
            cout << arr[i][j] << "  ";
            }
            else {
                cout << arr[i][j] << "   ";
            }
        } cout << endl; 
    } 
    
    
    
    
    
    //////////////////////////////
    
    for (size_t i = 0 ; i < rows ; i++){
        delete[] arr[i];
    } 
    delete[] arr ; 
    return 0;
}
INFO