Reference no: EM132206671
Write a new program (hw6-pr2) meeting at least the following minimum requirements:
Prompt the user to enter a string of 9 characters consisting of 4 digits (0-9), followed by a period (.), followed by 4 more digits (0-9), e.g. 1234.5678.
Be sure to check for a correctly formatted input. Convert the input string into two integers (one from the first 4 digits and one from the last 4 digits) and one double (from the entire string).
Display the resulting values (all on one line). Display each of the two integers in the following formats: decimal, octal (starting with "0") and hexadecimal (starting with "Ox").
Put all 3 versions of each integer on the same line in columns 10 characters wide (i.e. use two lines of display for the two integers).
Display the double in the following formats: default Moat, fixed and scientific. Put all 3 versions of the double on the same line in columns 20 characters wide.
Do this twice, first with the default precision, and then using a precision of 8.
Capture each of the four lines displayed above (two integer version lines and two double version lines) into a string and then display the string.
The displayed lines should be identical to those previously displayed.