numbers that fell in the following categories: 1-10, 11-20, 21-30, 31-40, 41-50, 51-60, 61-70, 71-80, 81-90, 91-100. You must display a “*” for every five students in each category. The diagram on the right shows the histogram for the given numbers.txt file. e) Your program should conclude by displaying the following statistical information: i) The amount of students who specified valid favourite numbers, the amount of students who specified invalid favourite numbers, and the amount of students who did not reveal their favourite number. ii) The number/s that was/were chosen the most by the students, if at least two students chose that number. iii) The number/s that was/were chosen the least by the students, if at least one student chose that number. Programming Guidelines 1. You must use functions for b) i) to b) vi). 2. For b) v) you must write your own power and numDigits functions. The power function takes two positive integers n and p , calculates and returns n p . Use of the pow function is not allowed. The prototype of the power function is: int power (int, int); The numDigits function accepts a positive integer n , finds and returns the number of digits in n . For example, if n is 10398, numDigits should return 5. The prototype of the numDigits function is: int numDigits(int); These function must be used in determining whether a function is plus perfect or not. 3. To find out the binary equivalent of a number in b) vi), you should repeatedly divide the number by 2 until zero is obtained. An array may be used for storing the remainders. Submission Instructions Create and test the program as detailed above. The name of the program is your UWI Student Id number and the extension is .cpp . Upload only the .cpp file to myElearning no later than 2 nd February 2019 at 11:59pm . Absolutely no late or emailed submissions will be accepted.
- Spring '17
- Natural number, Prime number, Favourite Number