Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int Tura();
- int Points;
- int main()
- {
- srand(time(NULL));
- int First = 0;
- int ScoreFirst = 0;
- int Second = 0;
- int ScoreSecond = 0;
- for (int j = 1; j <= 5; j++)
- {
- cout << "Tura " << j <<endl;
- cout << "Gracz pierwszy\n";
- First = Tura();
- cout << "\n Liczba punktow dla gracza 1 = " << First << "\n";
- ScoreFirst += First;
- cout << "Gracz Drugi\n";
- Second = Tura();
- cout << "\n Liczba punktow dla gracza 2 = " << Second << "\n";
- ScoreSecond += Second;
- cout << "Koniec " << j << " tury"<<endl;
- }
- cout << "\n Wynik gracza 1 = " << ScoreFirst;
- cout << "\n Wynik gracza 2 = " << ScoreSecond;
- if (ScoreFirst < ScoreSecond)
- {
- cout << "\n Wygrywa pierwszy zawodnik";
- }
- else if (ScoreFirst > ScoreSecond)
- {
- cout << "\n Wygrywa drugi zawodnik";
- }
- else
- {
- cout << "\n REMIS!";
- }
- return 0;
- }
- int Tura()
- {
- int Dice1, Dice2;
- for (int i = 1; i <= 10; i++)
- {
- Dice1 = rand() % 6 + 1;
- Dice2 = rand() % 6 + 1;
- int SumPoints = Dice1 + Dice2;
- cout << Dice1 << " + " << Dice2 << " = " << SumPoints << "\n\n";
- if (i == 1 and SumPoints == 7)
- {
- Points = 0;
- break;
- }
- else if (i == 1 and SumPoints == 11)
- {
- Points = 0;
- break;
- }
- else if (i == 1 and SumPoints == 2)
- {
- Points = 12 / i;
- break;
- }
- else if (i == 1 and SumPoints == 12)
- {
- Points = 12 / i;
- break;
- }
- else if (SumPoints == 5)
- {
- break;
- }
- else
- {
- Points += SumPoints / i;
- }
- }
- return Points;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement