Write a program that simulates 1000 rolls of a single die and summarizes the results in a table.
The results are to be displayed in a table formatted as shown below where ### indicates an integer value displayed in a field three characters wide.
Dots Frequency ---- --------- 1 ### 2 ### 3 ### 4 ### 5 ### 6 ###
None. This program has no input.
Your program should include a value-returning function that returns a random integer value in the range 1 to 6 inclusive. Your main program should invoke this function 1,000 times and count how many times it returns a 1, how many times it returns a 2, and so on.
C++ includes a function named rand( ) that returns random numbers in the range 0 to RAND_MAX (inclusive). RAND_MAX is usually the same as INT_MAX (the largest possible integer value). Random numbers in the range 0 to n-1 inclusive can be generated using this expression:
rand()%n
For example, to generate one of 6 random values in the range 0 to 5 inclusive, use this expression:
rand()%6