1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GrogVix [38]
3 years ago
6

What to do: please remember to comment each line.

Computers and Technology
1 answer:
Anni [7]3 years ago
3 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   //initialization

  float x=0.0;

  float y;

  char operation;

  //print the message

   cout<<"Please enter the operation (Addition or Subtraction): ";

   cin>>operation;

   //loop for enter th operand again until enter 'q'

  while(operation != 'q'){

       //print the message for operand x

      cout<<"\nPlease enter the operand x: ";

      cin>>x;

       //print the message for operand y

      cout<<"\nPlease enter the operand y: ";

      cin>>y;

   //check for condition for '+' and if true then add the operands

      if(operation == '+'){

          x=x+y;

      }else if(operation == '-'){  //if user enter '-' then subtract the operands

          x=x-y;

      }

      //print the output

      cout<<"\nThe output is: "<<x<<endl;

      cout<<"\nPlease enter the operation (Addition or Subtraction): ";

      cin>>operation;

  }

  return 0;

}

Explanation:

Create the main function and define the variable x equals zero and declare the variables y and operation.

print the message for the user to enter the operation ('+' or '-') by using the instruction cout.

Store the value in the variable by using the instruction cin.

Then, take the loop to repeat the statement again and again until the condition is true.

print the message inside the loop for asking about the operands from the user.

then, use condition statement for checking the operation and if condition match, then execute the particular operation.

The above operation executes until the user enters not enter the character 'q'.

when the user enters the 'q', the loop terminates and print the output.

You might be interested in
It is easier to make an object move across the screen by using the tweening function rather than creating each individual frame
Vesna [10]
Uhhhh I believe it’s true if it’s wrong I’m srry ....
3 0
3 years ago
Who do we make games for?(single term)
Ket [755]

Answer:

Gamers

Explanation:

5 0
3 years ago
Read 2 more answers
What is true about an electric field around a negative charge?
FrozenT [24]

The electric field points outward

8 0
3 years ago
Read 2 more answers
Glenda operates an Airbnb business in which she rents an apartment for $150US per night . There is a mandatory deposit of 50 dol
Kipish [7]

Answer:

Steps of the technological design process include: identify a problem, research the problem, generate possible solutions, select the best solution, create a model, test the model, refine and retest the model as needed, and communicate the final solution.

Explanation:

3 0
3 years ago
Which one of the following media is unguided media ?​
krok68 [10]

Explanation:

1. radio transmission.

2. microwave transmission

3. infrared transmission.

4 0
3 years ago
Other questions:
  • A ____ appearing in the main text of a document indicates a footnote or endnote.
    15·1 answer
  • How do I download the Microsoft word on my Hp probook
    8·2 answers
  • What two actions does the RETI instruction perf orm? Why must these two actions be done in a single instruction, as opposed to a
    6·1 answer
  • What are two major techniques involved in green computing
    14·1 answer
  • Write a Python program that prompts the user for the cost of two items to be purchased. Then prompt the user for payment. If the
    11·1 answer
  • Which role involves designing and creating advertisements for marketing purposes?
    14·2 answers
  • 1. select the correct answer from the given options.
    5·1 answer
  • Who plays xbox one offline and knows some multiplayer games that can be played offline.
    15·2 answers
  • Need help asap please​
    13·1 answer
  • If u play codm pls tell me ur username
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!