Objective
- The purpose of this program is to generate random numbers, report total number created, how many were 15, 16, or 17 and report this information to the user.
- You are required to use array, pointer and customised functions in this lab tutorial
Description of the Problem
Your program should contain the prototypes fillArray, count15s16sAnd17s, and writeResults functions. In your main function:
1. Create an array of 1000 integers in your main function.
2. The array is passed to a function named fillArray.
- The function asks the user for the seed value and calls srand().
- Next, it fills the array with random numbers that are within the range 10 to 50 inclusive-that is, the possible numbers are 10, 11, 12, ... 49, 50.
- Use modulus arithmetic and simple arithmetic to adjust each of your random numbers to be within the given range.
3. From main, call a function named count15s16sAnd17s.
- The function is passed your array of numbers.
- The function goes through your array and counts the total number of 15's, 16's, and 17's that are in your array.
- The function "returns" the total number of 15's, 16's and 17's.
4. Call a function named writeResults,
- The function is passed the three total values (count of 15's, 16's, and 17's).
- The function writes the three totals to the screen in a manner similar to what is shown below.
5. Do not have a "do another" loop. Your program will run this set of functions only once.
Sample Output
This program generated 1000 random numbers within the range 10 to 50.
The total number of 15's is 23.
The total number of 16's is 27.
The total number of 17's is 25.