Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- const int M = 8;
- const int N = 6;
- int zal[N][M];
- int num, i, j, tmp = 0;
- for(i=1; i<=M; i++){
- for(j=1; j<=N; j++){
- zal[i][j] = 1 + rand()%2;
- cout << zal[i][j] << " ";
- }
- cout << endl;
- }
- cout << "Enter: ";
- cin >> num;
- for (i = num; i>=1; i--){
- if (tmp == 0 ){
- for(j = N; j>=1; j--){
- if (zal[i][j] == 1){
- cout << endl << "Vash bilet " << i << " ryad " << j << " mesto." << endl;
- tmp = 1; break;
- }
- }
- } else{
- break;
- cout << endl << "Svobodnih mest net";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement