Question
Create a function called binary that will take a decimal number (can assume short int) and return a string of binary digits. Since it is
Create a function called binary that will take a decimal number (can assume short int) and return a string of binary digits. Since it is short int, the largest string of digits would be about 16 assume the number is positive.
Have the main program input the numbers, check to make sure the number is not not negative. If they are print an error message. Otherwise call the binary function and print the answer.
For this, you may have just one file with main and the function together. I Need It To be in C++
For 5 points extra credit, have the binary function handle a negative number.
THANK YOU !
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started