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
JulijaS [17]
3 years ago
15

Write a program which accepts two integers from the user. Then it asks the user what he wants to do with those two numbers. If t

he user choice is
‘A’ – Add the two numbers

‘B’ – Subtract the second number from the first number

‘C’ – Multiply the first number by the second number

‘D’ – Divide the first number by the second number

‘Q’ – End the operation

Your program should continue to accept the two numbers and the user choice unless the user enters ‘Q’ as choice.
Computers and Technology
1 answer:
il63 [147K]3 years ago
3 0

Answer:

// program in C++.

#include <bits/stdc++.h>

using namespace std;

// function to print choice menu

void menu()

{

   cout<<"A – Add the two numbers:"<<endl;

   cout<<"B – Subtract the second number from the first number:"<<endl;

   cout<<"C – Multiply the first number by the second number:"<<endl;

   cout<<"D – Divide the first number by the second number:"<<endl;

   cout<<"Q – End the operation:"<<endl;

}

// driver function

int main()

{

// variables

int x,y;

char ch;

int flag=1;

do{

   cout<<"Enter first number:";

   // read first number

   cin>>x;

   cout<<"Enter second number:";

   // read second number

   cin>>y;

   // call menu function

   menu();

   cout<<"Enter your choice:";

   // read choice

   cin>>ch;

   switch(ch)

   {

       case 'A':

       case 'a':

       cout<<"Addition of two numbers is:"<<(x+y)<<endl;

       break;

       case 'B':

       case 'b':

       cout<<"Subtract the second from the first is:"<<(x-y)<<endl;

       break;

       case 'C':

       case 'c':

       cout<<"Multiplication of two numbers is:"<<(x*y)<<endl;

       break;

       case 'D':

       case 'd':

       cout<<"Division the first by the second is:"<<(x/y)<<endl;

       break;

       case 'Q':

       case 'q':

       flag=0;

   }

   if(flag==0)

   break;

   

}while(ch!='Q'||ch!='q');

return 0;

}

Explanation:

Read two numbers from user.Then read the choice for operation on both the numbers. Then print the choices of operation by calling menu() function.If choice is "A"  then print Addition of both.if choice is "B" then print subtraction of second from  first number.if choice is "C" then print the multiplication of both numbers.If choice is "D" then print division of first by second.If the choice is "Q" then quit the operation. Repeat this until user's choice is "Q".

Output:

Enter first number:6                                                                                                      

Enter second number:2                                                                                                      

A – Add the two numbers:                                                                                                  

B – Subtract the second number from the first number:                                                                      

C – Multiply the first number by the second number:                                                                        

D – Divide the first number by the second number:                                                                          

Q – End the operation:                                                                                                    

Enter your choice:A                                                                                                        

Addition of two numbers is:8                                                                                              

Enter first number:8                                                                                                      

Enter second number:2                                                                                                      

A – Add the two numbers:                                                                                                  

B – Subtract the second number from the first number:                                                                      

C – Multiply the first number by the second number:                                                                        

D – Divide the first number by the second number:                                                                          

Q – End the operation:                                                                                                    

Enter your choice:Q      

You might be interested in
Which of the case studies that you read (Walmart, Target or 5 Big Data Industries) caught your attention and why? Before reading
IrinaK [193]

Answer:

Walmart has caught my attention many times, and definitely when I was reading a case study on it recently. The data that they have collected is from all over the world, and probably the most well planned as it originates from some very high level and good analytics, awesome queries and various other heterogeneous sources. And they have a very unique way of using this data. Being an Engineer however myself, I have studied Data warehousing and Data mining in detail as well as Machine learning. And Walmart first collects the data using Data warehousing, and then it cleans it using the statistics, artificial intelligence, machine learning and statistics, and finally makes a model using the machine learning. They call it all together Data science, and the collected data is being termed as big data, and it has all typos of data which includes images, text, video, sound, animations, and all. Apart from Walmart, you can think of all the social media sites, e-commerce sites, and a lot more.  All are using the data warehousing, data mining and Machine learning all together.  

Explanation:

The answer is self explanatory.

7 0
3 years ago
Which technological tool is important for storing critical files?.
Vanyuwa [196]

The technological tools that can be considered important for storing critical files are battery backup systems and drives. These devices can be used to store data and supply energy.

<h3>Battery backup systems</h3>

A home battery backup system is a device used to keep the electrical system working in the event when the electrical source goes down.

In computation, there are three major classes of batteries systems:  Lead-Acid, Nickel-Cadmium, and Lithium-Ion.

An uninterruptible power supply (UPS) can be considered as a battery backup supply capable of charging when the power is on.

Learn more about battery backup systems here:

brainly.com/question/7125266

3 0
2 years ago
Module 1 and 2 Coding Guided Notes Fill in your answers to each response as you read through the lesson pages in the coding cour
creativ13 [48]

Answer:

Code; code; program.

Explanation:

1. Instructions for computers to solve a problem is known as code. Computer code is how humans and machines talk to each other. Some examples of programming language used to write a code in instructing a computer for the execution of a task are python, Java, Javascript, ruby, c++, c# etc.

2. Learning to code or write a program allows for a solution to a problem.

4 0
3 years ago
Read 2 more answers
When engineers consider _____, they propose giving up a benefit of one proposed design in order to obtain a benefit of a differe
spin [16.1K]

Answer:

The answer is A. Constraint.

5 0
3 years ago
Which statement is true about the storage media?
Ksivusya [100]

The statement which is true about storage media is "Cache memory is much faster than Magnetic disk storage. But it is much expensive than magnetic disks."

The cache memory is faster than both SDDs and HDDs. In mathematical terms, it is 4 time faster than SSDs and 80 times faster than HDDs. Moreover, it is more expensive then the SSDs and HDDs storage. Practically speaking, it is not good to have as much in-memory storage as persistent block storage on SSDs or HDDs.

The remaining statements are incorrect such as "Cost per bit in SSDs is lower than that of a Magnetic tapes". While truth be told the SSD cost more than the Magnetic Tapes.

Magnetic disk storage is faster than SSD storage and hence it is a good candidate for a database that needs faster access time. The statement is also incorrect as SSD are much faster than Magnetic Disk Storage.

Learn more in: brainly.com/question/25026748

8 0
2 years ago
Other questions:
  • The email application used by Jim’s office is sending emails with viruses attached to them to user’s computers. What step should
    13·2 answers
  • A small graphic that you click on to perform a function in a software program is called a _____.
    15·1 answer
  • A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in
    13·1 answer
  • A feature that displays in the lower right corner of a selected range with which you can analyze your data by using Excel tools
    12·2 answers
  • How can I change my username here at brainly?
    13·2 answers
  • What If smart phones / computers didn't exist? <br>​
    5·1 answer
  • You and a friend have just started a small business. How could you use the Internet to make your business successful?
    15·2 answers
  • For risk monitoring, what are some techniques or tools you can implement in each of the seven domains of a typical IT infrastruc
    7·1 answer
  • User name ideas for ro blox? I'm changing mine and I dont know what I want. No numbers or underscores!
    10·2 answers
  • what new technology led to the chaos that spurred the establishment of the federal communications commission?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!