35657

Untitled

Feb 23rd, 2024
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.  
  8.     int arr1[2][2];
  9.  
  10.     int arr2[2][2]{ {1,2}, {7,8} };
  11.  
  12.     int arr3[2][2]{ 1,2,7,8 };
  13.  
  14.     int arr4[3][3]{ {7,8}, {1,2,3} };
  15.  
  16.     const int row = 3; // количество строк
  17.  
  18.     const int col = 5; // количество столбцов
  19.  
  20.     int arr5[row][col];
  21.  
  22.     srand(time(NULL));
  23.  
  24.     for (int i = 0; i < row; i++) { // индекс строки
  25.         for (int j = 0; j < col; j++) { // индекс столбца
  26.             arr5[i][j] = rand() % 100;
  27.         }
  28.     }
  29.  
  30.     for (int i = 0; i < row; i++) {
  31.         for (int j = 0; j < col; j++) {
  32.             cout << arr5[i][j] << '\t';
  33.         }
  34.         cout << endl;
  35.     }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment