Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int ja=0, komputer=0,komputerX;
- srand(time(NULL));
- cout << "nozyce = 0 papier = 1 kamien = 2 "<< endl;
- for(;;)
- {
- if(ja==5)
- {
- cout<<"Wygrywasz"<<endl;
- break;
- }
- if(komputer==5)
- {
- cout<<"Wygrywa komputer"<<endl;
- break;
- }
- cout << ja << " " << komputer << endl;
- cout << "wybierz: ";
- cin>> ja;
- komputerX=rand()%3;
- cout<<komputer<<endl;
- if(ja==0 && komputerX==0)
- {
- cout << "punkty dla obojga"<<endl;
- ja++;
- komputer++;
- continue;
- }
- if(ja==1 && komputerX==1)
- {
- cout << "punkty dla obojga"<<endl;
- ja++;
- komputer++;
- continue;
- }
- if(ja==2 && komputerX==2)
- {
- cout << "punkty dla obojga"<<endl;
- ja++;
- komputer++;
- continue;
- }
- if(ja==0 && komputerX==1)
- {
- cout << "punkt dla ciebie"<<endl;
- ja++;
- continue;
- }
- if(ja==0 && komputerX==2)
- {
- cout << "punkty dla komputera"<<endl;
- komputer++;
- continue;
- }
- if(ja==1 && komputerX==0)
- {
- cout << "punkt dla komputera"<<endl;
- komputer++;
- continue;
- }
- if(ja==1 && komputerX==2)
- {
- cout << "punkt dla ciebie"<<endl;
- ja++;
- continue;
- }
- if(ja==2 && komputerX==0)
- {
- cout << "punkt dla ciebie"<<endl;
- ja++;
- continue;
- }
- if(ja==2 && komputerX==1)
- {
- cout << "punkt dla komputera"<<endl;
- komputer++;
- continue;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement