Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What to do: please remember to comment each line. 1 Initialize x to be zero 2 Pr

ID: 3621019 • Letter: W

Question

What to do: please remember to comment each line.
1 Initialize x to be zero

2 Prompt the user for the next operation (Addition or Subtraction)

3 Prompt the user for the next operand (y).

4 Perform the operation (x + y or x – y depends on the operation selected by
the user), and store back the result to x.

5 Output x in decimal.

6 Go back to step 2 until user input “q” as the next operation, then exit.


• Operations:
• Addition: perform x = x + y (when user input “+”)
• Subtraction: perform x = x - y (when user input “-”)
• quit: (when user input “q”).


• Operands:
• One operand (x) is initialized to be zero (defined in .data), and updated as
the result; the other operand is always provided by the user


• Output:
• Decimal value of the current result (x).


• Include integer multiplication (*) and division (/) operations
-perform x = x * y (when user input “*”), and output the product.
- perform x = x / y (when user input “/”), and output both the
quotient and remainder. In this case, x needs to be updated as the
quotient.

Explanation / Answer

// test1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int x = 0, y=0 , z=0, r =0; // initiaqlizing all variables to 0; char s; // input character as oeratopn from user while (true) { // this loop runs until user enters q as opertion cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote