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
salantis [7]
3 years ago
6

Write a calculator program that keep reading operations and double numbers from user, and print the result based on the chosen o

peration using while loop. The loop must stop if the user enters Q letter.
NOTE: no need to write two classes.

Typical run of the program:

Enter an operation(+,-,*,/), Q to quit: +

Enter your first number: 6

Enter your second number: 5

Result= 11.0

Enter an operation(+,-,*,/), Q to quit: *

Enter your first number: 5

Enter your second number: 5

Result= 25.0

Enter an operation(+,-,*,/), Q to quit: q

You calculator has been ended!
Computers and Technology
1 answer:
AveGali [126]3 years ago
5 0

Answer:

 #include <iostream>

using namespace std;

int main()

{

   char opt;

   double num1,num2;

   cout<<"Enter an operation(+,-,*,/), Q to quit: ";

   cin>>opt;

  while(opt != 'Q'){

      cout<<"\nEnter your first number: ";

      cin>>num1;

      cout<<"\nEnter your second number: ";

      cin>>num2;

      if(opt == '+'){

          cout<<"Result = "<<num1+num2<<endl;

      }else if(opt == '-'){

           cout<<"Result = "<<num1-num2<<endl;

      }else if(opt == '*'){

           cout<<"Result = "<<num1*num2<<endl;

      }else if(opt == '/'){

           cout<<"Result = "<<num1/num2<<endl;

      }

      cout<<"Enter an operation(+,-,*,/), Q to quit: ";

      cin>>opt;

  }

  return 0;

}

Explanation:

First, include the library iostream, it allows to use the input/output instruction.

Create the main function and declare the variables.

Then print the message on the screen using cout instruction.

cin instruction is used to store the value into the variable.

then, take a while and check the condition if the value enters by the user is 'Q' or not. if true then enter the while otherwise exit.

after that, store the number enter by the user in the variables and then take the if-else statement for matching the operation enter by the user if match true then do the match operation.

This process continues until the user enters the value 'Q'.

if the user enters the 'Q'  then condition false and exit the program.

You might be interested in
A _____ stores definitions, such as data types for fields, default values, and validation rules for data in each field.
PIT_PIT [208]
The answer to this question is the term Data Dictionary. A Data Dictionary or also known as metadata repository is a set of information that is stored which contains data, meanings, and values. The data dictionary can be used as a tool for communication between the stakeholders.
5 0
3 years ago
What is the process of publishing a work in Photoshop?
Sunny_sXe [5.5K]

Photoshop is a software program developed by Adobe that allows users to edit graphics. It's used by graphic artists, designers and photographers, among others, and can enhance and manipulate images to improve their appearance. It's an excellent tool that makes photo editing easy and efficient.

Explanation:

  • In the past, it produced creative printing or home publishing programs used for desktop publishing too, but the primary page layout software from Corel is CorelDraw
  • Adobe InDesign is a desktop publishing and typesetting software application produced by Adobe Systems. It can be used to create works such as posters, flyers, brochures, magazines, newspapers, presentations, books and ebooks
  • Adobe InDesign is a standard piece of publishing software, and is commonly used by professional typesetters to design the inside pages of books.
  • Select an image, and then choose File > File Info
  • Use the File Info dialog box to view or edit an image's metadata. This dialog box displays quite a bit of information. Many of the settings in it are important in the metadata.
  • Metadata is a set of standardized information about a file, such as author name, resolution, color space, copyright, and keywords applied to it.
8 0
3 years ago
Which of the follow is an example of an integer?<br> "1.091"<br> "number"<br> 15<br> name
UkoKoshka [18]

Answer:

The answer is 15

Explanation:

A integer is a whole number, the only wholenumber present is 15

Hope this helps :)

8 0
2 years ago
Symbols can enhance your text. You can add mathematical or currency symbols, geometric shapes, and even smiley faces. Under whic
Sliva [168]
The answer is D. Hope this helped.
4 0
3 years ago
What learning about computer
uysha [10]

<em>Computer-based learning (CBL) is the term used for any kind of learning with the help of computers. Computer-based learning makes use of the interactive elements of the computer applications and software and the ability to present any type of media to the users.</em>

8 0
3 years ago
Other questions:
  • What is my credit card billing zip code??
    15·1 answer
  • Using numerous computers to inundate and overwhelm the network from numerous launch points is called a(n) ________ attack.
    9·1 answer
  • "As part of integrating your solution your client indicates that they have certain technologies enabled on their network that al
    6·1 answer
  • The Apple iPhone was a revolutionary product when it was introduced in 2007. To what extent do you agree or disagree with this s
    8·1 answer
  • Define time management and give two activities that you can do to help manage your tasks, homework, or projects better.
    12·1 answer
  • To ____ a public member function of a base class in the derived class, the corresponding function in the derived class must have
    12·1 answer
  • How does a junction table handle a many-to-many relationship?
    10·1 answer
  • Question #8
    13·1 answer
  • If person A creates an image with a creative common license. Person B then uses the image on his website. Who own the image and
    7·1 answer
  • Consider the following code snippet that appears in a subclass: public void deposit(double amount) { transactionCount ++; deposi
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!