Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

+Programming I (Section 136321) LA1E1 (7 points-C++Program Exclude any existing source code files that may alread aming it CIA1E1_main.cpp. Write in be in your IDE

image text in transcribed
+Programming I (Section 136321) LA1E1 (7 points-C++Program Exclude any existing source code files that may alread aming it CIA1E1_main.cpp. Write in be in your IDE project and add a new one nte a program in that file to display two input values in octal, exadecimal, and decimal. Your program must: 1. not use cout more than twice: 2. not use cin more than once: 3. not use a looping statement: 4. not test anything: 5. use cout to prompt the user to enter two space-separated positive integer numeric values. The i hexadecimal while the second must be in octal. Do not precede the values with r use cin to obtain and stor use cout to display th 6. 7. e first input value in hexadecimal, octal, and decimal in the format shown on the first line below, and the same cout to display the second input value in octa exadecimal, and decimal in the format shown on the second line below. D represents the e and store those values in two type int variables: l. ecimal value, O represents the octal value, and H represents the hexadecimal value H hexadecimal - o octal D decimal 0 octal H hexadecimal D decimal For example, when run on a machine having a 32-bit type int a user input of 7 7 produced: 7 hexadecimal 7 octal 7 decimal 7 octal 7 hexadecimal = 7 decimal a user input of 1A 17 produced la hexadecimal 32 octal 26 decimal 17 octal f hexadecimal 15 decimal a user input of abc 777 produced: abc hexadecimal 5274 octal 2748 decimal 777 octal = 1ff hexadecimal 511 decimal Note that cout and printf both display integer octal and hexadecimal values as unsigned, which is he reason you will get "strange" results if you enter a negative value. Manually re-run your program several times, testing with at least the following 3 input value pairs: a 7 100 100 def 500

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions