1. Write a C++ program that simulates the throw of a dice. The program allows the user to enter the number of throws he/she would like to do. The program then, will calculate the statistics of the number of faces appears in these throws. The program should satisfies the following:
    a. List the subtasks that are required when breaking down the problem
    b. List all functions that you may use in the program
    c. Define the functions required for your program and show both precondition as well as postconditions of these functions before implementing them in your code
    d. You need to implement all of your program activities in separate functions. Then test your function from within the main function. You should not do any calculation or task in the main function ( apart from calling the functions ).
    e. Make sure that the program will not allow the user to enter inappropriate values of the number of throws.
    f. In case inappropriate number entered, the program should prompt the user to re-enter the number of throws again until is entered correctly.
    g. As soon as the user enters the correct number if throws, then the program do the rest and calculate the statistics required.

You've simply pasted what looks like an assignment without even asking for anything. What do you think this is?

Make an attempt. Report back with specific questions when you are stuck.

If you are stuck that means you made an attempt. Show your attempt and ask specific questions.

Happy coding :)

Most of the people on here could easily help you with this, but you need to show some initiative and actually write some code that we could look at and help you with. I don't know your level of skill, but this program is a very, very, simple one. Step 1--collect a valid number of rolls (an int?) Step 2--roll the dice and collect the statistics (an array of int?) Step 3--calculate statistics (number of 1's over total rolls = % of 1's which were rolled, for instance...) Step 4--User feedback of % of 1's, % of 2's, % of 3's...number of total rolls. Here's a clue: each step can be implemented as a function. Implement the logic in a logical way: collect the input, do the processing and then provide the output...

Like I said though, if you come up with some code people will be a lot more likely to offer you some advice, but we aren't getting paid to do your work for you so we don't have any incentive to just write a program for you do we?

This article has been dead for over six months. Start a new discussion instead.