Advertisement
makispaiktis

Roulette (cases 1,2,3, 10)

Aug 3rd, 2019 (edited)
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 25.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <ctime>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. // Auxiliary function
  9. /*
  10. // **** QUESTION to the user ****
  11.             if(money == 0){
  12.                 goto exit;
  13.             }
  14.             else{
  15.                 cout << endl << "---> Do you want to continue betting?" << endl;
  16.                 string response;
  17.                 cin >> response;
  18.                 if(response == "yes" || response == "YES" || response == "Yes"){
  19.                     goto menu;
  20.                 }
  21.                 else if(response == "no" || response == "NO" || response == "No"){
  22.                     goto exit;
  23.                 }
  24.                 else{
  25.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  26.                     goto menu;
  27.                 }
  28.         }
  29. */
  30.  
  31.  
  32. // Global Variables
  33. // Matrix for case 1
  34. int redColours[] = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36};
  35.  
  36. int main()
  37. {
  38.     srand(time(NULL));
  39.     int counterOfRounds = 0;
  40.     int roundsWon = 0;
  41.     int roundsLost = 0;
  42.     float moneyWonInRounds = 0;         // It's for the money the user takes in THE ROUNDS HE WON
  43.     float moneyLostInRounds = 0;        // It's for the money the user loses in the ROUNDS HE LOST
  44.  
  45.     // 1. Intro - Rules
  46.     cout << "Welcome to the famous CASINO GAME - THE ROULETTE !!!!" << endl;
  47.     cout << "First, a few words about the game: " << endl;
  48.     cout << "A) First, you have to tell me how much money you have and give me your bet (value in euros). There are numbers from 1 to 36 and the 0." << endl;
  49.     cout << "B) Secondly, you have to decide about the kind of bet: " << endl;
  50.     cout << "   1) You can bet in a colour (write red, black but NOT in the green colour(ONLY 0 IS GREEN))" << endl;
  51.     cout << "   2) Bet in even/odds." << endl;
  52.     cout << "   3) Bet either 1-18 or 19-36" << endl;
  53.     cout << "   4) Bet in dozens: 1-12 or 13-24 or 25-36." << endl;
  54.     cout << "   5) Bet in columns (1,4,7,....  or  2,5,8,....  or  3,6,9,....)." << endl;
  55.     cout << "   6) Bet six numbers in row (1,2,3,4,5,6  or  ....  or  31,32,33,34,35,36)." << endl;
  56.     cout << "   7) Bet four numbers in row." << endl;
  57.     cout << "   8) Bet three numbers in row." << endl;
  58.     cout << "   9) Bet two numbers in row." << endl;
  59.     cout << "  10) Bet a single number." << endl << endl;
  60.  
  61.  
  62.  
  63.  
  64.  
  65.     // 2. Ask the user to give me how much money do you have
  66.     cout << "\n\n****************************************************\n";
  67.     cout << "First,  give me how much money do you have?" << endl;
  68.     cout << "Money: ";
  69.     float money;
  70.     cin >> money;
  71.     while(money <= 0){
  72.         cout << "Money: ";
  73.         cin >> money;
  74.     }
  75.     cout << endl;
  76.     while(money <= 0){
  77.         cout << "Money: ";
  78.         cin >> money;
  79.         cout << endl;
  80.     }
  81.     cout << "****************************************************\n";
  82.     cout << endl;
  83.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
  84.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
  85.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
  86.     float initialMoney = money;
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. // **** Here will be the CHECKPOINT FOR GOTO ****
  96. menu:
  97.     counterOfRounds ++;
  98.     cout << endl << "                    ROUND " << counterOfRounds << "\n";
  99.     // 3. Ask the user to give me his bet
  100.     cout << "\n\nNow, it's time to give me how much money are you gonna bet?" << endl;
  101.     cout << "Bet: ";
  102.     float bet;
  103.     cin >> bet;
  104.     while(bet <= 0 || bet > money){
  105.         cout << "Bet: ";
  106.         cin >> bet;
  107.     }
  108.     cout << endl;
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.     // 4. Create the random number of roulette
  116.     int randomRouletteNumber = rand() % 37;
  117.     // 5. After the creation of random number, I ask the user to select a category of bet
  118.     cout << "Now, you have to select the category of your bet. The available numbers are shown above (1 to 10).\n";
  119.     cout << "Check the number in front of the bet you want and type it!\n";
  120.     int userBetOption;
  121.     cin >> userBetOption;
  122.     while(userBetOption <= 0 || userBetOption > 10){
  123.         cin >> userBetOption;
  124.     }
  125.  
  126.  
  127.  
  128.  
  129.     // *******************************************************************************************************
  130.     // *******************************************************************************************************
  131.     // CASE 1- BET IN RED OR BLACK
  132.     if(userBetOption == 1){
  133.         cout << "You chose to bet by colour. Type 'red' or 'black'.\n";
  134.         string colourSelected;
  135.         cin >> colourSelected;
  136.  
  137.         if(colourSelected == "red" || colourSelected == "RED" || colourSelected == "Red"){
  138.             cout << "\nYou bet **** " << bet << " **** money in the **** " << colourSelected << " **** colour.\n";
  139.             bool isItRed = false;
  140.             for(int i=0; i<sizeof(redColours)/sizeof(redColours[0]); i++){
  141.                 if(randomRouletteNumber == redColours[i]){
  142.                     isItRed = true;                     // Flag becomes true, if random number EXISTS in my list of red numbers
  143.                 }
  144.             } // End of for
  145.  
  146.             cout << "Roulette ball stands in:   " << randomRouletteNumber << endl;
  147.             //  New if-case to check the value of my flag
  148.             if(isItRed == true){
  149.                 cout << "Nice! You won " << bet << " money with this bet." << endl;
  150.                 money += bet;
  151.                 roundsWon ++;                       // **** Extra ****
  152.                 moneyWonInRounds += bet;            // **** Extra ****
  153.                 cout << "Your money now:  " << money << endl;
  154.             }
  155.             else{
  156.                 cout << "Such a same! You lost " << bet << " money with this bet." << endl;
  157.                 money -= bet;
  158.                 roundsLost ++;                       // **** Extra ****
  159.                 moneyLostInRounds += bet;            // **** Extra ****
  160.                 cout << "Your money now:  " << money << endl;
  161.             }
  162.  
  163.             // **** QUESTION to the user ****
  164.             if(money == 0){
  165.                 goto exit;
  166.             }
  167.             else{
  168.                 cout << endl << "---> Do you want to continue betting?" << endl;
  169.                 string response;
  170.                 cin >> response;
  171.                 if(response == "yes" || response == "YES" || response == "Yes"){
  172.                     goto menu;
  173.                 }
  174.                 else if(response == "no" || response == "NO" || response == "No"){
  175.                     goto exit;
  176.                 }
  177.                 else{
  178.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  179.                     goto menu;
  180.                 }
  181.             }
  182.  
  183.         } // END OF RED BET
  184.  
  185.         else if(colourSelected == "black" || colourSelected == "BLACK" || colourSelected == "Black"){
  186.             cout << "\nYou bet **** " << bet << " **** money in the **** " << colourSelected << " **** colour.\n";
  187.             bool isItRed = false;
  188.             for(int i=0; i<sizeof(redColours)/sizeof(redColours[0]); i++){
  189.                 if(randomRouletteNumber == redColours[i]){
  190.                     isItRed = true;                     // Flag becomes true, if random number EXISTS in my list of red numbers
  191.                 }
  192.             } // End of for
  193.  
  194.             cout << "Roulette ball stands in:   " << randomRouletteNumber << endl;
  195.             //  New if-case to check the value of my flag
  196.             if(isItRed == false){
  197.                 cout << "Nice! You won " << bet << " money with this bet." << endl;
  198.                 money += bet;
  199.                 roundsWon ++;                       // **** Extra ****
  200.                 moneyWonInRounds += bet;            // **** Extra ****
  201.                 cout << "Your money now:  " << money << endl;
  202.             }
  203.             else{
  204.                 cout << "Such a same! You lost " << bet << " money with this bet." << endl;
  205.                 money -= bet;
  206.                 roundsLost ++;                       // **** Extra ****
  207.                 moneyLostInRounds += bet;            // **** Extra ****
  208.                 cout << "Your money now:  " << money << endl;
  209.             }
  210.  
  211.             // **** QUESTION to the user ****
  212.             if(money == 0){
  213.                 goto exit;
  214.             }
  215.             else{
  216.                 cout << endl << "---> Do you want to continue betting?" << endl;
  217.                 string response;
  218.                 cin >> response;
  219.                 if(response == "yes" || response == "YES" || response == "Yes"){
  220.                     goto menu;
  221.                 }
  222.                 else if(response == "no" || response == "NO" || response == "No"){
  223.                     goto exit;
  224.                 }
  225.                 else{
  226.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  227.                     goto menu;
  228.                 }
  229.             }
  230.  
  231.         } // END OF BLACK BET
  232.  
  233.         else{               // If the user typed WRONG WORD EXCEPT RED OR BLACK
  234.             cout << colourSelected << " is not a colour in roulette! Invalid option....\n";
  235.             cout << "Your money now: " << money << endl;
  236.  
  237.             // **** QUESTION to the user ****
  238.             if(money == 0){
  239.                 goto exit;
  240.             }
  241.             else{
  242.                 cout << endl << "---> Do you want to continue betting?" << endl;
  243.                 string response;
  244.                 cin >> response;
  245.                 if(response == "yes" || response == "YES" || response == "Yes"){
  246.                     goto menu;
  247.                 }
  248.                 else if(response == "no" || response == "NO" || response == "No"){
  249.                     goto exit;
  250.                 }
  251.                 else{
  252.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  253.                     goto menu;
  254.                 }
  255.             }
  256.         }
  257.  
  258.         cout << endl;
  259.     }
  260.         // **** END OF CASE 1 ****
  261.  
  262.  
  263.  
  264.  
  265.     // *******************************************************************************************************
  266.     // *******************************************************************************************************
  267.     // Case 2 - Even or odd numbers
  268.     else if(userBetOption == 2){
  269.         cout << "You chose to bet on even/odds. Type 'even' or 'odd'.\n";
  270.         string evenOrOdd;
  271.         cin >> evenOrOdd;
  272.  
  273.         if(evenOrOdd == "even" || evenOrOdd == "EVEN" || evenOrOdd == "Even"){
  274.             cout << "\nYou bet **** " << bet << " **** money in the **** " << evenOrOdd << " **** numbers.\n";
  275.             cout << "Roulette ball stands in:   " << randomRouletteNumber << endl;
  276.             if(randomRouletteNumber % 2 == 0 && randomRouletteNumber != 0){
  277.                 cout << "Nice! You won " << bet << " money with this bet.\n";
  278.                 money += bet;
  279.                 roundsWon ++;                       // **** Extra ****
  280.                 moneyWonInRounds += bet;            // **** Extra ****
  281.                 cout << "Current money: " << money << endl;
  282.             }
  283.             else{
  284.                 cout << "Such a shame! You lost " << bet << " money with this bet.\n";
  285.                 money -= bet;
  286.                 roundsLost ++;                       // **** Extra ****
  287.                 moneyLostInRounds += bet;            // **** Extra ****
  288.                 cout << "Current money: " << money << endl;
  289.             }
  290.  
  291.             // **** QUESTION to the user ****
  292.             if(money == 0){
  293.                 goto exit;
  294.             }
  295.             else{
  296.                 cout << endl << "---> Do you want to continue betting?" << endl;
  297.                 string response;
  298.                 cin >> response;
  299.                 if(response == "yes" || response == "YES" || response == "Yes"){
  300.                     goto menu;
  301.                 }
  302.                 else if(response == "no" || response == "NO" || response == "No"){
  303.                     goto exit;
  304.                 }
  305.                 else{
  306.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  307.                     goto menu;
  308.                 }
  309.         }
  310.  
  311.         } // END OF EVEN BET
  312.  
  313.         else if(evenOrOdd == "odd" || evenOrOdd == "ODD" || evenOrOdd == "Odd"){
  314.             cout << "\nYou bet **** " << bet << " **** money in the **** " << evenOrOdd << " **** numbers.\n";
  315.             cout << "Roulette ball stands in:   " << randomRouletteNumber << endl;
  316.             if(randomRouletteNumber % 2 == 0 && randomRouletteNumber != 0){
  317.                 cout << "Such a shame! You lost " << bet << " money with this bet.\n";
  318.                 money -= bet;
  319.                 roundsLost ++;                       // **** Extra ****
  320.                 moneyLostInRounds += bet;            // **** Extra ****
  321.                 cout << "Current money: " << money << endl;
  322.             }
  323.             else{
  324.                 cout << "Nice! You won " << bet << " money with this bet.\n";
  325.                 money += bet;
  326.                 roundsWon ++;                       // **** Extra ****
  327.                 moneyWonInRounds += bet;            // **** Extra ****
  328.                 cout << "Current money: " << money << endl;
  329.             }
  330.  
  331.             // **** QUESTION to the user ****
  332.             if(money == 0){
  333.                 goto exit;
  334.             }
  335.             else{
  336.                 cout << endl << "---> Do you want to continue betting?" << endl;
  337.                 string response;
  338.                 cin >> response;
  339.                 if(response == "yes" || response == "YES" || response == "Yes"){
  340.                     goto menu;
  341.                 }
  342.                 else if(response == "no" || response == "NO" || response == "No"){
  343.                     goto exit;
  344.                 }
  345.                 else{
  346.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  347.                     goto menu;
  348.                 }
  349.         }
  350.  
  351.         } // END OF ODD BET
  352.  
  353.         else{                       // In case of invalid option from user
  354.             cout << "That's not a valid option.... You wrote '" << evenOrOdd << "' instead of writing 'even' or 'odd'.\n";
  355.             cout << "Current money: " << money << endl;
  356.  
  357.             // **** QUESTION to the user ****
  358.             if(money == 0){
  359.                 goto exit;
  360.             }
  361.             else{
  362.                 cout << endl << "---> Do you want to continue betting?" << endl;
  363.                 string response;
  364.                 cin >> response;
  365.                 if(response == "yes" || response == "YES" || response == "Yes"){
  366.                     goto menu;
  367.                 }
  368.                 else if(response == "no" || response == "NO" || response == "No"){
  369.                     goto exit;
  370.                 }
  371.                 else{
  372.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  373.                     goto menu;
  374.                 }
  375.                 }
  376.         }
  377.  
  378.         cout << endl;
  379.     }
  380.     // **** End of CASE 2 ****
  381.  
  382.  
  383.  
  384.     // CASE 3
  385.     else if(userBetOption == 3){
  386.         cout << "Now write '1to18' or '19to36' for bet:\n" << endl;
  387.         string answer;
  388.         cin >> answer; // not for strings including spacebars
  389.         //getline(cin, answer);
  390.  
  391.         if(answer == "1to18"){
  392.             cout << "\nSo, you bet **** " << bet << " **** money betting from **** " << answer << " ****\n";
  393.             cout << "Roulette ball stands in " << randomRouletteNumber << endl;
  394.             if(randomRouletteNumber >=1 && randomRouletteNumber <=18){
  395.                 cout << "Nice, you won " << 2*bet << " with this bet.\n";
  396.                 money += bet;
  397.                 roundsWon ++;
  398.                 moneyWonInRounds += bet;
  399.                 cout << "Current money: " << money << endl;
  400.             }
  401.  
  402.             else{
  403.                 cout << "Such a shame! You lost " << bet << " with this bet.\n";
  404.                 money -= bet;
  405.                 roundsLost ++;
  406.                 moneyLostInRounds += bet;
  407.                 cout << "Current money: " << money << endl;
  408.             }
  409.  
  410.             // **** QUESTION to the user ****
  411.             if(money == 0){
  412.                 goto exit;
  413.             }
  414.             else{
  415.                 cout << endl << "---> Do you want to continue betting?" << endl;
  416.                 string response;
  417.                 cin >> response;
  418.                 if(response == "yes" || response == "YES" || response == "Yes"){
  419.                     goto menu;
  420.                 }
  421.                 else if(response == "no" || response == "NO" || response == "No"){
  422.                     goto exit;
  423.                 }
  424.                 else{
  425.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  426.                     goto menu;
  427.                 }
  428.         }
  429.  
  430.  
  431.         } // End of first if
  432.  
  433.         else if(answer == "19to36"){
  434.  
  435.             cout << "\nSo, you bet **** " << bet << " **** money betting from **** " << answer << " ****\n";
  436.             cout << "Roulette ball stands in " << randomRouletteNumber << endl;
  437.             if(randomRouletteNumber >=19 && randomRouletteNumber <=36){
  438.                 cout << "Nice, you won " << 2*bet << " with this bet.\n";
  439.                 money += bet;
  440.                 roundsWon ++;
  441.                 moneyWonInRounds += bet;
  442.                 cout << "Current money: " << money << endl;
  443.             }
  444.  
  445.             else{
  446.                 cout << "Such a shame! You lost " << bet << " with this bet.\n";
  447.                 money -= bet;
  448.                 roundsLost ++;
  449.                 moneyLostInRounds += bet;
  450.                 cout << "Current money: " << money << endl;
  451.             }
  452.  
  453.             // **** QUESTION to the user ****
  454.             if(money == 0){
  455.                 goto exit;
  456.             }
  457.             else{
  458.                 cout << endl << "---> Do you want to continue betting?" << endl;
  459.                 string response;
  460.                 cin >> response;
  461.                 if(response == "yes" || response == "YES" || response == "Yes"){
  462.                     goto menu;
  463.                 }
  464.                 else if(response == "no" || response == "NO" || response == "No"){
  465.                     goto exit;
  466.                 }
  467.                 else{
  468.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  469.                     goto menu;
  470.                 }
  471.         }
  472.  
  473.  
  474.         } // End of 2nd else if
  475.  
  476.         else{
  477.             cout << "Invalid option. I asked you to reply saying '1to18' or '19to36', but you wrote " << answer << endl;
  478.             // **** QUESTION to the user ****
  479.             if(money == 0){
  480.                 goto exit;
  481.             }
  482.             else{
  483.                 cout << endl << "---> Do you want to continue betting?" << endl;
  484.                 string response;
  485.                 cin >> response;
  486.                 if(response == "yes" || response == "YES" || response == "Yes"){
  487.                     goto menu;
  488.                 }
  489.                 else if(response == "no" || response == "NO" || response == "No"){
  490.                     goto exit;
  491.                 }
  492.                 else{
  493.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  494.                     goto menu;
  495.                 }
  496.         }
  497.         } // End of third else
  498.  
  499.     } // ********************************* END OF CASE 3 *********************************
  500.     // ***********************************************************************************
  501.  
  502.     // ***********************************************************************************
  503.     // Starting CASE 10 - SINGLE NUMBERS BET
  504.     else if(userBetOption == 10){
  505.  
  506.         cout << "You chose to bet in a single number. Now, write down in which special number you touch your hopes (0 to 36).\n";
  507.         int singleNumberBet;
  508.         cin >> singleNumberBet;
  509.         // CHECK IF THIS IS A VALID OPTION
  510.         while(singleNumberBet < 0 || singleNumberBet > 36){
  511.             cin >> singleNumberBet;
  512.         }
  513.         cout << "So, you bet **** " << bet << " **** money in the single number **** " << singleNumberBet << " ****\n";
  514.         cout << "Roulette balls stands in number " << randomRouletteNumber << endl;
  515.         // Checking if the user is lucky and ask him to continue
  516.         if(singleNumberBet == randomRouletteNumber){
  517.             cout << "Oh, YES!!!! It's clear you are so lucky today!!!! You bet in " << singleNumberBet << " and here is where the ball stopped.\n";
  518.             cout << "**** You won " << 35 * bet << " with this impossible and so lucky bet. ****\n";
  519.             money += 35*bet;
  520.             roundsWon++;
  521.             moneyWonInRounds += 35*bet;
  522.             cout << "Current money: " << money << endl << endl;
  523.             // **** QUESTION to the user ****
  524.             if(money == 0){
  525.                 goto exit;
  526.             }
  527.             else{
  528.                 cout << endl << "---> Do you want to continue betting?" << endl;
  529.                 string response;
  530.                 cin >> response;
  531.                 if(response == "yes" || response == "YES" || response == "Yes"){
  532.                     goto menu;
  533.                 }
  534.                 else if(response == "no" || response == "NO" || response == "No"){
  535.                     goto exit;
  536.                 }
  537.                 else{
  538.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  539.                     goto menu;
  540.                 }
  541.             }
  542.  
  543.        } // End of if ---> if singleNumberBet == randomRouletteNumber
  544.  
  545.        // Create the else if -case when singleNumberBet != randomRouletteNumber
  546.         else{
  547.             cout << "You hunted the 1/37 possibility and lost. Especially, you lost **** " << bet << " .****\n";
  548.             money -= bet;
  549.             roundsLost++;
  550.             moneyLostInRounds += bet;
  551.             cout << "Current money: " << money << endl << endl;
  552.             // **** QUESTION to the user ****
  553.             if(money == 0){
  554.                 goto exit;
  555.             }
  556.             else{
  557.                 cout << endl << "---> Do you want to continue betting?" << endl;
  558.                 string response;
  559.                 cin >> response;
  560.                 if(response == "yes" || response == "YES" || response == "Yes"){
  561.                     goto menu;
  562.                 }
  563.                 else if(response == "no" || response == "NO" || response == "No"){
  564.                     goto exit;
  565.                 }
  566.                 else{
  567.                     cout << "You didn't response with 'yes' or 'no' as I expected, but I'll consider that you are continuing!\n";
  568.                     goto menu;
  569.                 }
  570.             } // End of else when don't responding with yes or no
  571.  
  572.         } // End of else (singleNumberBet != randomRouletteNumber)
  573.  
  574.     }   // End of CASE 10
  575.     // *******************************************************************************************************************
  576.     // *******************************************************************************************************************
  577.  
  578.  
  579.  
  580. // **********************************************
  581. // **********************************************
  582. // Exit label for goto
  583. exit:
  584.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
  585.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
  586.     cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl << endl;
  587.  
  588.     // Check if the user won or lost money in casino while playing the roulette
  589.     float gainOrLoss = money - initialMoney;
  590.     cout << "                   S U M M A R Y " << endl;
  591.     if(gainOrLoss > 0){
  592.         cout << "Initial Money: " << initialMoney << endl;
  593.         cout << "  Money now  : " << money << endl;
  594.         cout << "    Gain     : +" << gainOrLoss << endl;
  595.     }
  596.     else if(gainOrLoss < 0){
  597.         cout << "Initial Money: " << initialMoney << endl;
  598.         cout << "  Money now  : " << money << endl;
  599.         cout << "    Loss     : " << gainOrLoss << endl;
  600.     }
  601.     else{
  602.         cout << "Initial Money: " << initialMoney << endl;
  603.         cout << "  Money now  : " << money << endl;
  604.         cout << "  Gain/Loss     : " << gainOrLoss << endl;
  605.     }
  606.  
  607.     // Extra Statistics
  608.     cout << "\nDo you want to see extra statistics of your performance today?\n";
  609.     string answerForExtraStatistics;
  610.     cin >> answerForExtraStatistics;
  611.     if(answerForExtraStatistics == "yes" || answerForExtraStatistics == "YES" || answerForExtraStatistics == "Yes"){
  612.         cout << endl << endl << "   E X T R A   S T A T I S T I C S\n";
  613.         cout << "Rounds played: " << counterOfRounds << endl;
  614.         cout << "Rounds won   : " << roundsWon << "(" << 100 * roundsWon / counterOfRounds << "%)" << endl;
  615.         cout << "Rounds lost  : " << roundsLost << "(" << 100 * roundsLost / counterOfRounds << "%)" << endl;
  616.         cout << "Money won    : " << moneyWonInRounds << endl;
  617.         cout << "Money lost   : " << -moneyLostInRounds << endl;
  618.         cout << "Gain/loss    : " << moneyWonInRounds-moneyLostInRounds << endl;
  619.     }
  620.  
  621.  
  622.     return 0;
  623. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement