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
which statement is true? O A Future games will be more context oriented. OB. Future games will be more product driven. Future ga
Wittaler [7]

Answer:

b

Explanation:

7 0
3 years ago
Read 2 more answers
Which View option allows you to view your document as it would appear when posted online?
kondaur [170]

I assume this is in regards to Microsoft Word?


If so, then the Web Layout view will allow you to view the document as it would look on a webpage.

3 0
4 years ago
An electronic ____ is an application you use to perform numeric calculations and to analyze and present numeric data.
attashe74 [19]

An electronic \sf\purple{spreadsheet} is an application you use to perform numeric calculations and to analyze and present numeric data.

\bold{ \green{ \star{ \orange{Mystique35}}}}⋆

7 0
3 years ago
Hand tools are generally classified based on :​
makkiz [27]

Categories of hand tools include wrenches, pliers, cutters, files, striking tools, struck or hammered tools, screwdrivers, vises, clamps, snips, hacksaws, drills, and knives. Outdoor tools such as garden forks, pruning shears, and rakes are additional forms of hand tools. Portable power tools are not hand tools.

4 0
3 years ago
1000base-t is a standard for achieving throughputs ____ times faster than fast ethernet over copper cable.
meriva
An Average of 10 times faster.

Hope this helps!
3 0
3 years ago
Other questions:
  • Is a type of software program used to write code and develop other
    9·1 answer
  • Alpha Technologies, a newly established company, wants to share information about its work with people all over the world. Which
    9·1 answer
  • What's the best way to change the font size of all your notes pages at once?
    14·2 answers
  • Write a program that implement a bubble sort ?
    5·1 answer
  • One of your clients is looking into investing in direct participation programs. He is examining several different types of progr
    13·1 answer
  • You must. place a child in a federally approved child restraint device. if the child is
    5·2 answers
  • Which position most likely requires your Master's Degree for success
    7·1 answer
  • Join my me et.goo gle.etj-dovn-kds​
    11·1 answer
  • Who knows my cousin better?
    14·1 answer
  • Define print_shape() to print the below shape. Example output:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!