Question: Write a C++ program that does the following: 1.) Using the construct sizeof(), determine the size of unsigned long integers (declare them as long long
Write a C++ program that does the following:
1.) Using the construct sizeof(), determine the size of unsigned long integers (declare them as long long unsigned) on your computer. Display the result on the console (monitor).
2.) Prompt the User to enter an unsigned long integer
3.) Validate this entry as an unsigned integer and reject invalid entries.
4.) Prompt the User to enter a 2nd unsigned long integer (Range: 0 to 18,446,744,073,709,551,615). Prompt the User to ensure that this value is greater than the first integer entered.
5.) Validate this entry as an unsigned long, long integer and reject invalid entries.
6.) Each input value or entry must be labeled. Align the displayed binary values so that the entered values and any output value are aligned horizontally such that Bit 0 of each entry or output value is directly above or below Bit 0 of all other input values or output results.
7.) Add the two values together.
8.) Display each of the three values left-to-right as (a) binary, (b) hexadecimal, and (c) decimal.
9.) Pause the screen, prompting the User to press any key to continue.
10.) Examine the binary representation of the sum and note its value.
11.) When a key is pressed, clear the screen, redraw the two entered integer values, and execute (12)
12.) Subtract the second value that was entered from the first. Remember that the result will be negative so you must store the difference in an integer that can be either positive or negative.
13.) Display each of the three values left-to-right as (a) binary, (b) hexadecimal, and (c) decimal.
14.) Pause the screen, prompting the User to press any key to continue.
15.) Examine the binary representation of the difference and note how a negative value is formed.
16.) When a key is pressed, clear the screen, redraw the two entered integer values, and execute (17)
17.) Using the bitwise operator &, logically AND these two integers.
18.) Display each of the three values left-to-right as (a) binary, (b) hexadecimal, and (c) decimal.
19.) Pause the screen, prompting the User to press any key to continue.
20.) Examine the binary representation of the sum and note its value.
21.) When a key is pressed, clear the screen, redraw the two entered integer values, and execute (22)
22.) Using the bitwise operator |, logically OR these two integers.
23.) Display each of the three values left-to-right as (a) binary, (b) hexadecimal, and (c) decimal.
24.) Pause the screen, prompting the User to press any key to continue.
Thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
