Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<time.h>
- #include<cstdlib>
- #include<windows.h>
- using namespace std;
- int main()
- {
- int przedmiot,papier,kamien,nozyce,enemy;
- int *ip;
- int twoje_punkty=0, enemy_punkty=0;
- cout << "Witaj w grze papier, kamien, nozyce!" << endl;
- for(;;)
- {
- cout << "Papier=1; kamine=2; nozyce=3" << endl;
- cout << "Aby wyjsc wpisz '99'" << endl;
- cout << "Twoje punkty: " << twoje_punkty << endl;
- cout << "Punkty przeciwnika: " << enemy_punkty << endl;
- cout << "Wybierz przedmiot: ";
- cin >> przedmiot;
- srand(time(NULL));
- enemy=rand()%3+1;
- if(przedmiot==1)
- {
- cout << "Wybrales papier!" << endl;
- }
- else if (przedmiot==2)
- {
- cout << "Wybrales kamien!" << endl;
- }
- else if(przedmiot ==3)
- {
- cout << "Wybrales nozyce!" << endl;
- }
- switch(przedmiot)
- {
- case 1:
- przedmiot==papier;
- break;
- case 2:
- przedmiot==kamien;
- break;
- case 3:
- przedmiot==nozyce;
- break;
- case 99:
- exit(0);
- default:
- cout << "Nie ma takiej opcji!";
- break;
- }
- if(enemy==1)
- {
- cout << "Komputer wybral papier" << endl;
- }
- else if (enemy==2)
- {
- cout << "Komputer wybral kamien" << endl;
- }
- else if(enemy ==3)
- {
- cout << "Komputer wybral nozyce" << endl;
- }
- {
- if (enemy==1 && przedmiot==1)
- cout << "Macie to samo, probuj dalej!" << endl;
- else if (enemy==1 && przedmiot==2)
- {
- cout << "Papier owija kamien, punkt dla komputera!" << endl;
- enemy_punkty++;
- }
- else if (enemy==1 && przedmiot==3)
- {
- cout << "Nozyce tna papier, punkt dla Ciebie!" << endl;
- twoje_punkty++;
- }
- }
- {
- if (enemy==2 && przedmiot==1)
- {
- cout << "Kamien owija papire, zdobywasz punkt!" << endl;
- twoje_punkty++;
- }
- else if (enemy==2 && przedmiot==2)
- cout << "Macie to samo, probuj dalej!" << endl;
- else if (enemy==2 && przedmiot==3)
- {
- cout << "Kamien tepi nozyce, punkt zdobywa komputer!" << endl;
- enemy_punkty++;
- }
- }
- {
- if (enemy==3 && przedmiot==1)
- {
- cout << "Nozyce tna papier, punkt dla komputera!" << endl;
- enemy_punkty++;
- }
- else if (enemy==3 && przedmiot==2)
- {
- cout << "Kamien tepi nozyce, punkt zdobywasz Ty!" << endl;
- twoje_punkty++;
- }
- else if (enemy==3 && przedmiot==3)
- cout << "Macie to samo, probuj dalej!" << endl;
- }
- getchar();getchar();
- system("cls");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement