Question: Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories: for five of a kind, straight,

Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories: for "five of a kind", "straight", and "chance".
Your program must include the following functions. Each function must take one parameter, an array of 5 integers, that represents the numbers on the five dice cast (values can be 1 through 6).
chance() returns the sum of the dice
fiveOfKind() returns 50 if all five dice are the same value (otherwise 0)
straight() returns 40 for 1,2,3,4,5 or 2,3,4,5,6(otherwise 0)
isSorted() returns true if the dice values are in sorted order (each value is less than or equal to the next value in the array) otherwise false. This function should return a bool value (true or false). See section 3.12 for more information about the Boolean data type.
The main program should ask the user to enter the 5 dice values in ascending sorted order. If the input values are not in increasing, order, output the error message: "Error: not in increasing order". If the values are in increasing order, then the program should call the three functions to see which one returns the highest value, and output that value as the Highest Score.
Ex: If input is:
33333
the output is:
High score: 50
Ex: If input is:
24154
the output is:
Error: not in increasing order
Ex: If input is:
12445
the output is:
High score: 16
Follow the Style Guidelines (especially function header comments).
Do not use vectors! c++

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 Programming Questions!