C++ program code

OverviewFor this assignment, write a program that will simulate a single game of Craps.Craps is a game of chance where a player (the shooter) will roll 2 six-sided dice. The sum of the die will determine whether the player (and anyone that has placed a bet) wins immediately, loses immediately, or if the game continues. If the sum of the first roll of the die is equal to 7 or 11, the player wins immediately. If the sum of the first roll of the die is equal to 2, 3, or 12, the player has rolled “craps” and loses immediately. If the sum of the first roll of the die is equal to 4, 5, 6, 8, 9, or 10, the game will continue with the sum becoming the “point.” The object of the game is now for the player to continue rolling the die until they either roll a sum that equals the point or they roll a 7. If the player “makes their point,” they win. If they roll a 7, they lose.ProcessingThe program will use the random number generator to simulate the rolling of the die. Therefore, the random number generator must be seeded. This is done one time in the program. Use srand(time(0)).Next, roll the die by generating two random numbers between 1 and 6. The two numbers should be added together and then displayed along with the sum.If the sum of the die is equal to 7 or 11, the game is over and the player has won. Display a congratulatory message.If the sum of the die is equal to 2, 3, or 12, the game is over and the player has lost. Display a message indicating the player has lost.For any other sum, the sum is now the point and the game should continue until the user rolls the point again or rolls a 7. To do this:Save the sum (the point) in a variable so it can be used for a later comparisonDisplay the pointCreate a variable and initialize it to a value of your choice to indicate that the game should continue.In a loop that should execute as long as the game should continue:roll the die and display the two values along with the sumif the sum of the die is the same as the point, display a congratulatory message indicating the player has made their point and they won the game. Also change the variable that controls the loop to indicate the game should no longer continue.otherwise, if the sum of the die is 7, display a message that the player has lost the game and change the variable that controls the loop to indicate the game should no longer continue.Symbolic ConstantsThe program should use at least three symbolic constants. Some options are:an integer for each of the values (2, 3, and 12) that represents craps on the first roll of the diean integer that represents the value 7an integer that represents the value 11Processing Requirements1.     Make and use meaningful variable names.2.     Make sure to actually use the symbolic constants that are created.3.     Be sure to #include and 4.     The program MUST be fully documented according to the documentation standards on the course website. Include line documentation. There

💡 Buy the answer for only $12 Get it now →

is no need to document every single line, but logical “chunks” of code should be preceded by a line or two that describes what the “chunk” of code does.5.     Hand in a copy of the source code (CPP file) using Blackboard.OutputSome runs of the program follow. Your results probably won’t match these exactly because of the use of the time when seeding the random number generator.Run 1Player rolled: 1 + 6 = 7 You won!Run 2Player rolled: 2 + 3 = 5 The point is 5 Player rolled: 4 + 2 = 6Player rolled: 6 + 5 = 11Player rolled: 6 + 6 = 12Player rolled: 6 + 4 = 10Player rolled: 6 + 6 = 12Player rolled: 6 + 1 = 7 You seven’d out and lost!Run 3Player rolled: 1 + 4 = 5 The point is 5 Player rolled: 5 + 3 = 8Player rolled: 4 + 4 = 8Player rolled: 1 + 1 = 2Player rolled: 1 + 2 = 3Player rolled: 3 + 3 = 6Player rolled: 6 + 5 = 11Player rolled: 5 + 6 = 11Player rolled: 6 + 5 = 11Player rolled: 5 + 6 = 11Player rolled: 6 + 3 = 9Player rolled: 6 + 4 = 10Player rolled: 3 + 5 = 8Player rolled: 6 + 4 = 10Player rolled: 4 + 2 = 6Player rolled: 6 + 3 = 9Player rolled: 3 + 5 = 8Player rolled: 5 + 4 = 9Player rolled: 2 + 1 = 3Player rolled: 1 + 1 = 2Player rolled: 2 + 2 = 4Player rolled: 5 + 3 = 8Player rolled: 1 + 3 = 4Player rolled: 2 + 2 = 4Player rolled: 3 + 1 = 4Player rolled: 1 + 4 = 5 You rolled your point! You won!Run 4Player rolled: 2 + 2 = 4 The point is 4 Player rolled: 4 + 5 = 9Player rolled: 5 + 1 = 6Player rolled: 1 + 2 = 3Player rolled: 2 + 3 = 5Player rolled: 1 + 2 = 3Player rolled: 3 + 5 = 8Player rolled: 2 + 4 = 6Player rolled: 6 + 3 = 9Player rolled: 6 + 2 = 8Player rolled: 3 + 4 = 7 You seven’d out and lost!Extra CreditFor up to 5 points of extra credit, add code that will allow the player to play the game more than one time. Use a character variable. The user should enter value of ‘y’ or ‘Y’ to indicate they would like to continue playing.Note about extra credit: the points will ONLY be awarded if the required portions of the assignment work correctly. In other words, don’t take short cuts in the rest of the program because it is assumed that 5 extra points will be awarded.Extra Credit OutputPlayer rolled: 3 + 5 = 8        The point is 8 Player rolled: 2 + 2 = 4Player rolled: 2 + 1 = 3Player rolled: 5 + 4 = 9Player rolled: 3 + 5 = 8 You rolled your point! You won!  Would you like to play again (y for yes)? y Player rolled: 4 + 3 = 7 You won!  Would you like to play again (y for yes)? Y Player rolled: 6 + 4 = 10 The point is 10 Player rolled: 2 + 3 = 5Player rolled: 3 + 1 = 4Player rolled: 5 + 6 = 11Player rolled: 5 + 4 = 9Player rolled: 2 + 1 = 3Player rolled: 3 + 3 = 6Player rolled: 2 + 5 = 7 You seven’d out and lost!  Would you like to play again (y for yes)? y Player rolled: 4 + 2 = 6 The point is 6 Player rolled: 3 + 2 = 5Player rolled: 6 + 4 = 10Player rolled: 5 + 6 = 11Player rolled: 2 + 4 = 6 You rolled your point! You won!  Would you like to play again (y for yes)? n

💡 Buy the answer for only $12 Get it now →