Question: You are required to write a C++ program that creates uses recursion to convert a number to its binary. Your program should have a class

 You are required to write a C++ program that creates usesrecursion to convert a number to its binary. Your program should have

You are required to write a C++ program that creates uses recursion to convert a number to its binary. Your program should have a class Conversion with following details: 0 private 0 chor'l' char_number; 0 public 0 ConversionCconst chor' *number) I A parameterized constructor that takes a number in the form of a character array, calculates the size of the array received as a parameter and creates a space in the heap memory with size + 1. This constructor should also make the private data member char* char_number point to this heap memory location and copy the content of number to char_number. O void DecimalToBinary(int n) I This function should be able to convert the number from its decimal form to binary. This function should be recursive in nature. It may not have any loops. 0 void convertO I This function should convert char_number to an integer and call the DecimalToBinary(int n) function for conversion. 0 ~Conver'sionO I This destructor should be able to deallocate the memory used by char_number along with making char_number point to null pointer. Your main method should have char numberElG] which is used to take an input of a number in the form of a characters (character array) from the user. Once the input is taken from the user, use the following lines in the main method to begin the process of conversion. Your main method should have char' number[1@] which is used to take an input of a number in the form of a characters (character array) from the user. Once the input is taken from the user, use the following lines in the main method to begin the process of conversion. Conversion conversion = ConversionCnumber); conversion.convert(); You can only use and libraries. Below is the screenshot of the expected output of this program: Enter an integer to convert to binary: 99 Binary of 99 is: 1160611

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 Programming Questions!