Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <ctime>
  4. #include <random>
  5. #include <iomanip>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.    
  11.   srand (time(NULL));
  12.    int n1,n2; cout << "value" << endl; cin >> n1 >> n2;  //тут надо писать длину/ширину массива
  13.  
  14.   int **mas = new int *[n1];
  15.  
  16.  for (int cnt = 0; cnt < n1; cnt++)
  17.              int *mas = new int[n2];
  18.    
  19.  
  20.  for (int i = 0; i < n1; i++)
  21.         for (int j = 0; j < n2; j++)
  22.             mas[i][j] = rand() % 101;          
  23.  
  24.              
  25.     for (int i = 0; i < n1; i++)
  26.     {
  27.         cout << endl;
  28.         for (int j = 0; j < n2; j++)
  29.             {
  30.                 cout << setw(3) << mas[i][j] << " ";
  31.             }
  32.     }
  33.  
  34.  
  35.  
  36.     for (int i = 0; i < n1; i++)
  37.             delete mas;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement