Question: Need help ASAP. Correct answer will get a thumbs up! In this game, a player rolls two dice. Each die has six faces. Each face

Need help ASAP. Correct answer will get a thumbs up!

In this game, a player rolls two dice. Each die has six faces. Each face contains 1, 2, 3, 4, 5 and 6 spots. After the dice have come to rest, the sum of the spots on the two top faces is calculated. If the sum is 7 or 11 on the first throw the player wins. If the sum is 2, 3, or 12 on the first throw, the player loses. If the sum is 4, 5, 6, 8, 9 or 10 on the first throw, that sum becomes the players point. To win, a player must continue rolling the dice until the player roll s the point value. The player loses by rolling a 7 before rolling the point.

f a player wins one game, s/he will earn $10. Otherwise, s/he will lose $1. A player can

keep playing the game until s/he chooses to quit or his/her balance becomes 0 or less.

There are totally 10 players that can play the game.

All players information (name,balance, gain so far) is stored in the file players.txt.

When your program is started, the balance and gain of each player should be retrieved from this file. Before a player quit your program, your program should make sure the file players.txt contains the latest balance and gain for each player.

When started, your program will first display a menu, which contains items: 0) top up

your balance, 1) play game, 2) top 5 players by balance, 3) top 5 winners by what theyhave won, and 4) exit the game.

When a user chooses option 0), your program should ask his/her name first and then let the user input the amount of money s/he wants to put into the balance.

When a user choose option 1), your program should ask his/her name first and then let him/her play the game.

You have to use an array of structures to store the information about every player. You will initialize the array when your program starts using information in the file players.txt, update the array as a player is playing the game and flush the information in the array into the file players.txt after a user choose to terminate your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!