Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Zaria.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- srand(0);
- int money = 50;
- int bet = 0;
- int firstcheat = 20;
- int cheat = 5;
- for (;;)
- {
- cout << "You have: " << money << " euros" << endl;
- cout << "How much do you want to bet?";
- cin >> bet;
- if (bet > money)
- {
- cout << "You dont have that much!" << endl;
- }
- else
- {
- int dice1 = 0;
- int dice2 = 0;
- for (;;)
- {
- dice1 = (rand() % 6) + 1;
- dice2 = (rand() % 6) + 1;
- if ((firstcheat % 4) == 0)
- {
- dice1 = 5;
- dice2 = 6;
- }
- firstcheat--;
- cheat--;
- if (cheat == 0)
- {
- dice1 = 1;
- dice2 = 2;
- cheat = 5;
- }
- cout << "You have thrown: " << dice1 << " " << dice2 << endl;
- if ((dice1 == 6 && dice2 == 6) || (dice1 == 6 && dice2 == 5) || (dice1 == 5 && dice2 == 6) || (dice1 == 3 && dice2 == 3) || (dice1 == 5 && dice2 == 5))
- {
- cout << " you won!" << endl;
- money = money + bet;
- break;
- }
- else
- {
- if ((dice1 == 1 && dice2 == 1) || (dice1 == 1 && dice2 == 2) || (dice1 == 2 && dice2 == 1) || (dice1 == 4 && dice2 == 4) || (dice1 == 2 && dice2 == 2))
- {
- cout << " you lost" << endl;
- money = money - bet;
- break;
- }
- }
- }
- }
- if (money == 0)
- {
- cout << "You are tapi!! Game over!" << endl;
- break;
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement