Convert Decimal to Hex, Binary, and Octal
- Create a comment header, at the top of the document.
- It must contain your name, the course (and semester)
- brief description of what the program does.
- Line up your braces
- Indent properly
- Use meaningful variable names.
- Make the code readable.
The project shall be called: “ConvDecimal_to_OtherBases”.
- Allow user to input an integer from 0 -> 2,000,000.
- Validate the input. If input is invalid, make them enter a value again (while), until they enter a valid value.
- Use the Division method for converting Decimal to Binary, and Hexadecimal, and Octal. ..1. Divide the quotient by 2 or 16 or 8, respectively. ..2. Get the remainder after dividing. Save the remainders. They are the answer.
- Display the answer with, the digits, in the proper order.
- Loop and ask user to input another positive integer.
- Stop looping and exit when the user enters “-1”.
- Create a function (and a corresponding .h file) named ConvDecimal().
- Make sure you store (and Add) this separate .cpp and .h file to your project.
- You will create 1 function that will convert Decimal to all 3 other bases (2, 16, and 8). You (the programmer) need to determine what the parameters should be for this function.
- This function will return nothing.
- At beginning of the program, display some kind of welcome message, stating to the user what this program does.
- When printing the results, display both the original decimal value and the calculated values.
- Display the output in a nice format.
- Testing
- Extensively test your program. Test with all type of integers values; valid and invalid data.