Question: Write In C++ It should run on Dev C++ compiler You are to create an electronic dice game based on the Craps. the basic rules

Write In C++ It should run on Dev C++ compiler

You are to create an electronic dice game based on the Craps. the basic rules are:

A player rolls two 6 sided dice. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. On the first throw:

  • If the sum is 7 or 11 the player wins.
  • If the sum is 2,3,or 12 (called "craps" ) the player loses and the house wins.
  • If the sum is 4,5,6,8,9, or 10 on the first throw, then that sum becomes the player's point

On subsequent throws

  • the player must continue rolling the dice until they "makes the point", i.e. rolls the same sum again. If the player rolls 7 before making the point, they lose.
  • Write a the following functions
    • getPlayer - get the player's first and last name separately (not all in one string)
    • getWager - get the amount of money the player wishes to wager on this game - win returns 2x, lose it all goes away.
    • rollDie - to simulate the rolling of a single six sided die. This function should return a random number between 1 and 6
    • firstRoll to simulate the first roll. This function should call rollDie two times.
      • It should then return:
        • 0 for a winning roll
        • -1 for a losing roll
        • the total roll value for non-winning / non-losing rolls aka the point
    • makePoint to simulate the later rolls. This function should take as input the "point" to be made
      • It should then return
        • -1 for a losing roll
        • 0 for non-winning / non-losing rolls
        • 1 for a winning roll
    • printResult to print the result of the die roll(s) when the player either wins or loses - this function needs a message and more depending on how you build it out

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a C electronic dice game based on Craps in Dev C youll need to implement the specified functions to simulate the die rolls capture user inpu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!