Question: In c++ Part 1 Write a program called hw4p1_$$$.c (where $$$ is replaced by your last name: all lower case). The program takes in a
In c++
Part 1 Write a program called hw4p1_$$$.c (where $$$ is replaced by your last name: all lower case). The program takes in a sequence of digits, and calculates how many times each digit appears and print this in numerical order. For example if the user enters 3498222, note that this sequence of digits has three 2s, one 3, one 4, one 8 and one 9. If the user enters 999, this sequence has three 9s. The program is supposed to calculate this. If a digit does not occur, the program must skip printing its count. Note that if the user input has any non-numeric input, the program must print "You must enter only digits!" and exit. Note also that I have not specified a limi to how long the sequence can be; your program must adhere to this specification. Some example runs are given below (your program must exactly be formatted as shown below): ./a.out 36474*72 You must enter only digits! >./a.out number of 9s 14 ./a.out 354662711293 number of 1s2 number of 2s = 2 number of 3s2 number of 4s = 1 number of 5s 1 number of 6s2 number of 7s1 number of 9s = 1 ./a.out number of 9s = 65
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
