subject

The Problem Your assignment is to write a C++ program using Microsoft Visual Studio, Xcode, repl. it, or such other C++ compiler you wish.
Start by calculating the size in bits of your operands. (See the Notes section later in this document.) Then issue message 1 described later in this assignment. The C++ program should then display a menu and prompt the user for a menu choice. Use messages 2A through 2I below for that prompt. Invalid choice values should be rejected. Issue message 3 in this case, then prompt the user again for correct values. Repeat this until a valid choice is received. The valid operator choices are:

AND &
OR |
XOR ^
NOT ~
Negate -
Left shift < (logical shift only)
Right shift > (logical shift only)
Stop execution = #
Once a valid choice is made, if the choice is '#', issue message 6 and end execution. Otherwise, ask the user for the operands using message 4A. (For the single-operand choices, NOT and Negate, issue message 4B.)

Perform the requested transformation. Display the output using message 5.

Continue with the message display again.

Notes

Your program should use unsigned integers for the input variables and the result variable. Use of 64-bit variables is encouraged.

To calculate the bit size, use the C++ sizeof command and multiply the result by 8.

Use cin for all input. Should an input error arise, abandon all further calculations and issue an error message (message 7 in the list below).

Use iomanip to produce the hexadecimal output. The width should be two times the results of the sizeof result.

Input

Input will be an operator chosen by the user from a menu, and one or two integer values. Your program will calculate the results for those two values.

Output

Output the resulting value from the specified logical operation. Issue error messages where required.

Output Message Text Values

Issue the following messages as shown below. Do not write different text or additional messages - this hinders automated grading and costs you points. If additional messages are needed, I will send an email to the class with those.

Message 1 - "Bitwise Operation Calculator - CS130 - nn bits - "
Replace with your first and last name. Replace nn with the size in bits of your operands.
Message 2A - "Enter one of the following choices:"
Message 2B - "& - AND"
Message 2C - "| - OR"
Message 2D - "^ - XOR"
Message 2E - "~ - NOT"
Message 2F - "- - Negate
Message 2G - "< - Left shift (logical shift only)"
Message 2H - "> - Right shift (logical shift only)"
Message 2I - "# - stop execution"
Message 3 - "Invalid choice x, please try again." Replace x with the user's choice.
Message 4A - "Enter values for first and second operand:"
Message 4B - "Enter value for first second operand:"
Message 5 - "Result: [Hexadecimal:] "
Replace with the result in decimal and replace with the result in hexadecimal.
Message 4 - "Error completing calculation - Flags:"
Replace with the contents of the EFLAGS register at the time of the error.
Message 5 - "Side x = "
Replace x with the side (a, b, or c) and replace with the calculated value for that side.
Message 6 - "Calculation ended."
Message 7 - "Input error, enter choice and values again."
Grading Standards

Correct numeric results for valid input - 28 points
Correct rejection of invalid input - 4 points
Correct results when errors - 4 points
Following naming and message format standards - 4 points

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 16:00
Does read theory have answers keys ?
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
1. which of these is not true about torsion bars? a. they can be used to adjust ride height b. they can be adjusted anytime since they don't affect alignment angles c. they attach between the frame and the lower control arm d. they twist to produce a spring effect
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
Click on the tab on the ribbon to open the backstage view. file view insert review
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
Acommon algorithm for converting a decimal number to binary is to repeatedly divide the decimal number by 2 and save the remainder. this division is continued until the result is zero. then, each of the remainders that have been saved are used to construct the binary number.write a recursive java method that implements this algorithm.it will accept a value of int and return a string with the appropriate binary character representation of the decimal number.my code: public class lab16{public string converttobinary(int input){int a; if(input > 0){a = input % 2; return (converttobinary(input / 2) + "" +a); } return ""; } }
Answers: 1
You know the right answer?
The Problem Your assignment is to write a C++ program using Microsoft Visual Studio, Xcode, repl. i...
Questions
question
Mathematics, 06.10.2019 20:20
question
English, 06.10.2019 20:20
Questions on the website: 13722367