Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <stdlib.h>
- #include <cmath>
- using namespace std;
- int koniec(int score, int scoreComp)
- {
- int con;
- system("CLS");
- if(score > scoreComp)
- cout << "WYGRALES!!!11111!!" << endl;
- else
- cout << "Hahahahaha PRZEGRYW" << endl;
- cout << "Jeszcze raz?" << endl;
- cout << "Jeszcze jak!==> 1" << endl;
- cout << "Ide spac==> Co kolwiek" << endl;
- cin >> con;
- if(con == 1)
- return 1;
- else
- return 0;
- }
- int pomoc()
- {
- cout << "Papier==> 1" << endl;
- cout << "Kamien==> 2" << endl;
- cout << "Nozyce==> 3" << endl;
- cout << "Pomoc ==> 4" << endl;
- cout << "Wyjscie==>9" << endl;
- }
- int main()
- {
- int score = 0,choice,comp,scoreComp=0,diff= 0,maxdiff,absolute,con;
- char words[3][10] = {"Papier","Kamien","Nozyce"};
- cout << "Witaj" << endl;
- cout << "Do jakiej przewagi gramy? 0=> piaskownica" << endl;
- cin >> maxdiff;
- system("CLS");
- pomoc();
- comp = rand() % 3+1;
- cin >> choice;
- system("CLS");
- while(choice != 9)
- {
- absolute = abs(score - scoreComp);
- if(maxdiff == absolute and maxdiff != 0)
- {
- con = koniec(score,scoreComp);
- if(con == 1)
- {
- score = scoreComp = 0;
- system("CLS");
- cout << "Papier, kamien, nozyce?" << endl;
- cin >> choice;
- }else{
- return 0;
- }
- }
- if(choice < 0 or (choice > 4 or choice == 9))
- {
- cout << "Ooj oj zly klawisz" << endl;
- cout << "Wprowadz ponownie" << endl;
- cin >> choice;
- system("CLS");
- }
- else{
- cout << "Wynik:" << score << endl;
- if(choice == 9)
- return 0;
- if(choice == 4)
- {
- pomoc();
- }else{
- cout << "Ty --- VS --- Komputer" << endl;
- cout << score << "--- VS ---"<< scoreComp << endl;
- cout << words[choice-1] << "--- VS ---"<< words[comp-1] << endl;
- if(comp == choice)
- {
- cout << "remis";
- }
- if(choice == 1)
- {
- if(comp == 2)
- {
- cout << "Papier przykrywa kamien WYGRALES" << endl;
- score++;
- }
- if(comp == 3)
- {
- cout << "Nozyce przecinaja papier PRZEGRALES" << endl;
- scoreComp++;
- }
- }
- if(choice == 2)
- {
- if(comp == 1)
- {
- cout << "Papier przykrywa kamien PRZEGRALES" << endl;
- scoreComp++;
- }
- if(comp == 3)
- {
- cout << "Kamien tempi nozyce WYGRALES" << endl;
- score++;
- }
- }
- if(choice == 3)
- {
- if(comp == 1)
- {
- cout << "Nozyce tna papier WYGRALES" << endl;
- score++;
- }
- if(comp == 2)
- {
- cout << "Kamien tempi nozyce PRZEGRALES" << endl;
- scoreComp++;
- }
- }
- }
- comp = rand() % 3+1;
- cin >> choice;
- system("CLS");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement