Question: a) Define a function named digitFrequency that returns how many times a given digit appears in a given integer n. The function prototype is as

a) Define a function named digitFrequency that returns how many times a given digit appears in a given integer n. The function prototype is as follows: int digitFrequency (int digit, int n); // precondition: digit is one of the 10 decimal digits For example, digitFrequency (3,1353) will return 2 because the frequency of 3 in 1353 is 2; digit Frequency (0, 0) will return 1; digit Frequency (3,-30003) will return 2; Note: you cannot use any C++ library functions. b) For this part, you need to write a main function/program that uses digit Frequency function you defined in part (a). Your program should ask the user for an integer, then display which decimal digit has the largest frequency in the user-input integer. For example, if the user enters -2686056, your program should display the following message: Digit 6 has the largest frequency which is 3 Note: You must use digitFrequency function you defined in part (a) to do this part
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
