64 752
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #17550 in C++ for Candice Battle

Question #17550
Develop a menu-driven program that inputs two numbers and, at the user’s option, finds their sum, difference, product, or quotient. Please give a example.
Expert's answer
#include <iostream>
#include <conio.h>
using namespace std;

int main ()
{
intchoice;
do{
system("cls");
cout<< "1) +" << endl;
cout<< "2) -" << endl;
cout<< "3) *" << endl;
cout<< "4) /" << endl;
cout<< "5) Exit" << endl;
cin>> choice;
if(choice == 1) {
system("cls");
intfirst, second;
cout<< "Enter first number: " << endl;
cin>> first;
cout<< "Enter second number: " << endl;
cin>> second;
cout<< "Result: " << first + second << endl;
system("pause");
}
elseif (choice == 2) {
system("cls");
intfirst, second;
cout<< "Enter first number: " << endl;
cin>> first;
cout<< "Enter second number: " << endl;
cin>> second;
cout<< "Result: " << first - second << endl;
system("pause");
}
elseif (choice == 3) {
system("cls");
intfirst, second;
cout<< "Enter first number: " << endl;
cin>> first;
cout<< "Enter second number: " << endl;
cin>> second;
cout<< "Result: " << first * second << endl;
system("pause");
}
elseif (choice == 4) {
system("cls");
doublefirst, second;
cout<< "Enter first number: " << endl;
cin>> first;
cout<< "Enter second number: " << endl;
cin>> second;
cout<< "Result: " << first / second << endl;
system("pause");
}
}while (choice != 5);
system("pause");
return0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions