Question: c++ 1.) The following is the algorithm to convert a decimal number (int) to a binary number: Ex: Convert 13 to 1101 a) First divide

 c++ 1.) The following is the algorithm to convert a decimal

number (int) to a binary number: Ex: Convert 13 to 1101 a)

c++

1.) The following is the algorithm to convert a decimal number (int) to a binary number: Ex: Convert 13 to 1101 a) First divide the integer number by 2, (binary is base 2). Ex: int num 5; int base 2; = 2 with a remainder of 1 2 b) Write down the remainder. c) Then divide the new number by two and write down the number. - Each time the new number is the quotient from the previous expression. 1 with a remainder of O 2 2 Write the remainders moving from right to left. d) Repeat steps a and b until the new number (quotient) is 0. = 0 with a remainder of 1 2 Answer 101 2.) Write a program that converts integer values to binary. The int values should be 0 or greater. 3.) Your program should first prompt the user to enter a non-negative integer. 4.) The program should have a recursive function named: dec ToBinary With the first function call in main), an integer value, initially representing the value entered by the user is passed to the function. The function is void-returning The function divides the number that is passed as an argument by 2. The remainder is output to the screen

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!