Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     const int M = 8;
  8.     const int N = 6;
  9.  
  10.     int zal[N][M];
  11.     int num, i, j, tmp = 0;
  12.  
  13.      for(i=1; i<=M; i++){
  14.         for(j=1; j<=N; j++){
  15.         zal[i][j] = 1 + rand()%2;
  16.         cout << zal[i][j] << " ";
  17.         }
  18.         cout << endl;
  19.      }
  20.  
  21.    
  22.  
  23.     cout << "Enter: ";
  24.     cin >> num;
  25.  
  26.  
  27.     for (i = num; i>=1; i--){
  28.         if (tmp == 0 ){
  29.             for(j = N; j>=1; j--){
  30.                 if (zal[i][j] == 1){
  31.                     cout << endl << "Vash bilet " << i << " ryad " << j << " mesto." << endl;
  32.                     tmp = 1; break;
  33.                 }
  34.                
  35.             }
  36.         } else{
  37.             break;
  38.             cout << endl << "Svobodnih mest net";
  39.         }
  40.        
  41.     }
  42.  
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement