Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main()
- {
- int CORDX,CORDY;
- CORDX = 0;
- CORDY = 0;
- int Plansza[5][5];
- srand(time(NULL));
- int position;
- /*Inicjalizacja planszy */
- for(int i = 0; i < 5; i++)
- {
- for(int j = 0; j < 5; j++)
- {
- position = 1 + rand()%4;
- Plansza[i][j] = position;
- }
- }
- /*Wyświetlanie planszy*/
- for(int i = 0; i < 5; i++)
- {
- for(int j = 0; j < 5; j++)
- {
- cout << Plansza[i][j];
- cout << " ";
- if(j==4) { cout << "|" << endl;}
- }
- }
- cout << "- - - - - - ";
- cout << endl;
- int bomba_one;
- int bomba_two;
- cout << "Set coordination: " << endl;
- while(true)
- {
- bomba_one = 1 + rand()%4 + 0;
- bomba_two = 1 + rand()%4 + 0;
- cout << "bomb: " << "[" << bomba_one << ", " << bomba_two << "]"<< endl;
- cout << "CORDX: ";
- cin >> CORDX;
- cout << "CORDY: ";
- cin >> CORDY;
- if( (CORDX==bomba_one) && (CORDY == bomba_two) )
- cout << "buuum" << endl;
- else
- cout << "Masz punkty!" << endl;
- }
- cin.ignore();
- cin.get();
- return 0;
- }
Add Comment
Please, Sign In to add comment