Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- #include<math.h>
- #define N 3
- using namespace std;
- int main()
- {
- srand(time(NULL));
- // 1. Intro
- cout << "Welcome to the famous casino game: F R U I T S\n";
- cout << "How much money do you have?\n\n";
- float money;
- cout << "Money: ";
- cin >> money;
- while(money <= 0){
- cout << "Money: ";
- cin >> money;
- }
- cout << endl;
- int counterOfRounds = 0;
- int roundsWon = 0;
- menu:
- counterOfRounds++;
- // 2. Inserting bet
- cout << endl << endl;
- float bet;
- cout << "* * * * R O U N D " << counterOfRounds << " * * * *" << endl << endl;
- cout << "Insert your bet: ";
- cin >> bet;
- cout << endl;
- while(bet <= 0){
- cout << "Insert your bet: ";
- cin >> bet;
- cout << endl;
- }
- cout << endl;
- // 3. Beginning the game
- int random1, random2, random3;
- random1 = rand() % N + 1;
- random2 = rand() % N + 1;
- random3 = rand() % N + 1;
- cout << random1 << " " << random2 << " " << random3 << endl << endl;
- // 4. Win or loss?
- if(random1 == random2 && random1 == random3){
- cout << "YOU WIN. You bet " << bet << " money and won " << bet * (N * N - 1) << endl;
- roundsWon++;
- }
- else{
- cout << "You lost " << bet << " money...";
- }
- // Ask the user if he wants to continue
- cout << "Continue? " << endl;
- string reply;
- cin >> reply;
- if(reply == "no" || reply == "No" || reply == "No"){
- goto exit;
- }
- else{
- if(reply != "yes" && reply != "Yes" && reply != "Yes"){
- cout << "You replied '" << reply << "' instead of 'yes' or 'no', but I suppose you continue.\n";
- }
- goto menu;
- }
- exit:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement