I Got STUCK ON PART 7, would appreciate it if someone can help out. I have it due on sunday
Thanks

we are going to implement a slightly different version of Roulette. In our version there will be only one player and the winner is determined solely by the slot the ball stops in.

Part 2 – Prototypes
  • Add the following prototypes to your program:

    void resetBets();
    int spinRouletteWheel();
    void takeBets(double &money);
    void playAgain(bool &decision);
    void payOuts(double &house, double &player, int spin);

Part 3 – Global variable
  • Add the following global variable to your program:

    int bets[37];

Part 4 – Main()
  • There's very little code in the main() function. The majority of the coding will be done in the functions. I've left the while-loop empty so that you can practice calling functions and get a better idea of how to use functions in your programs. It's up to you to figure out which functions to call and in what order. Hint: The body of the while-loop should contain function calls only. Also, the variables house and player represents the amount of money the house (dealer) and the player has respectively.

    bool play = true;
    double house = 0, player = 500;
    int spin;
    while(play) {
    /* Place your function calls here */
    }
    cout << endl << endl << "Thank you for playing";
    cout << endl << "House : " << house;
    cout << endl << "Player : " << player;
    cout << endl << endl;

Note: Some of the functions use call by reference

Part 5 – resetBets();
  • This function will initialize all the elements of the bets array to zero
Part 6– int spinRouletteWheel();
  • This function will return a random number between 0 and 36
Part 7 – void takeBets(double &money);
  • This function will ask the player where they would like to place a bet (0 to 36) and how much they would like to bet. The amount the player wants to bet should be subtracted from the variable money. The bet should be stored in the array in the same place as where the player would like to place his/her bet. For example, if the player would like to place his/her bet on the number 15 then the amount of the betshouldbestoredinthe15thpositionofthearray:bets[15] = amountOfBet;
Part 8 – void playAgain(bool &decision);
  • This function will ask the user if s/he would like to play again. If the player enters 'y' or 'Y' then
    decision should be set to true otherwise set it to false.
Part 9 – void payOuts(double &house, double &player, int spin);

Remember, the player only earns money on the bet that was placed on the same number that the ball landed on. The payout is based on the number of bets made:
A bet on one number only, called a straight-up bet, pays 35 to 1. A two-number bet, called split bet, pays 17 to 1.
A three-number bet, called street bet, pays 11 to 1.
A four-number bet, called corner bet, pays 8 to 1.
A six-number bet, pays 5 to 1. More than six bets pays 2 to 1
All the rest of the bets go to the dealer as well as 2.63% of the player's winnings.

Part 10 – while-loop
  • Now that you have written and tested all your functions it's time to use them. Modify the while-loop so that it calls the functions in the correct order

welcome to daniweb.

We try not to give full solutions to homework problems. So post what you've tried or indicate what specific concept/task you don't understand and any error message you may be getting and someone will probably step in to help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.