Advertisement
ULK

Лабораторная №9 (12.116)

ULK
Dec 6th, 2022
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int const m = 18;
  7.     int const n = 36;
  8.     int a[m][n];
  9.     int summ;
  10.     int c;
  11.     int i, j;
  12.  
  13.     summ = 0;
  14.     srand(time(0));
  15.  
  16.     for (i = 0; i < m; i++) {
  17.         for (j = 0; j < n; j++) {
  18.             a[i][j] = rand() % 2;
  19.             cout << a[i][j] << "\t";
  20.         }
  21.         cout << endl;
  22.     }
  23.     for (i = 0; i < m; i++)
  24.     {
  25.         c = 0;
  26.         for (j = 0; j < n; j++)
  27.         {
  28.             if (a[i][j] == 0) {
  29.                 c = 1;
  30.             }
  31.  
  32.         }
  33.         cout << endl;
  34.         if (c == 1) {
  35.             cout << "There are empty seats in the wagon " << i << endl;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement