Question: You are required to use the same menu driven program developed in the last class and now add the following two functions to it: Need

You are required to use the same menu driven program developed in the last class and now add the following two functions to it:

Need to write in C++

1. countTrailingZero(int m , int n) to count the trailing number of zeros in an integer m, after left shifting the number n times. Trailing zeros are the number of zeros you have in the binary conversion of the number on the right hand side before a 1 appears

Your answer should print out the result in decimal form.

int countTrailingZero(int, int)

Your output should be like this:

You are required to use the same menu driven program developed in

2. Write another function to calculate the occurrence of every character in the string. Both A and a are counted as one character.

the last class and now add the following two functions to it:

To do: develop a menu showing both of these

(a) You should include at least 2 different test routines for each function.

(b) All the functions including main() should be implemented in one C file, not several C files.

(c) Must have the convertToBinary() so that the shifts can be validated.

Please answer both parts and include all functions. Program should be written in C++.

MAIN MEN U 1. Input a new string 2. Calculate the length of the string 3. Check the number of occurance of each character 4. Check the trailing zeros in a number 5. Exit program Enter a number 1234 Enter the numbers to shift left 5 The number is 00000000000000000000010011010010 The new number is : 00000000000000001001101001000000 The number of trailing zeros are 6 after shifting 5 times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!