Question: In c + + plz Write a program to convert a decimal number to a unary number. A unary number where n > 0 ,

In c++ plz Write a program to convert a decimal number to a unary number. A unary number where n>0, is coded as n-1 bits followed by a zero bit. Here are some examples:
\table[[decimal,unary],[1,0],[2,10],[3,110],[4,1110],[5,11110],[6,111110],[7,1111110]]
Input from the keyboard a positive integer in the range [1,80]. Error check input. For each number, output to the screen the decimal number followed by its unary equivalent with no leading or trailing spaces. Finally, the program should ask if the user wants to run the program again (Check case). Refer to the sample output below.
Sample Run:
In c + + plz Write a program to convert a decimal

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!