#include <iostream>
using namespace std;
float sum(float x, float y){
return x+y;
}
float subtract(float x, float y){
return x-y;
}
float multiply(float x, float y){
return x*y;
}
float divide(float x, float y){
return x/y;
}
int main() {
while(true){
cout << "Enter your choice: " << endl;
cout << "1. Sum" << endl;
cout << "2. Subtraction" << endl;
cout << "3. Multiplication" << endl;
cout << "4. Division" << endl;
cout << "0. quit" << endl;
int choice;
float x, y;
cin >> choice;
switch(choice){
case 1:
cout << "Enter 2 nubmers: " << endl;
cin >> x >> y;
cout << sum(x, y) << endl;
break;
case 2:
cout << "Enter 2 nubmers: " << endl;
cin >> x >> y;
cout << subtract(x, y) << endl;
break;
case 3:
cout << "Enter 2 nubmers: " << endl;
cin >> x >> y;
cout << multiply(x, y) << endl;
break;
case 4:
cout << "Enter 2 nubmers: " << endl;
cin >> x >> y;
cout << divide(x, y) << endl;
break;
case 0:
cout << "quit!" << endl;
return 0;
}
}
return 0;
}




***********************************************************************************************************
Please upvote the answer. It will encourage me to answer more questions and it will be very helpful to me. Thank You.
***********************************************************************************************************
Problem 9: (20 Points) Write a CH program to implement sum, subtraction, multiplication and division operations...
usingc++ 1. Write a program to find the Sum(), Subtraction(), Multiplication(), Division() operations using Switch statement. For Division operation, please include denominator equals to zero check.
Using c++.. 1. Write a program to find the sum(), Subtraction(), Multiplication(), Division() operations using Switch statement and functions. 2. Write a program to find the summation of N numbers. Use two functions. One function will take the input from user and the other will perform the summation from 1 to N. 3. Write a program to find the factorial of a number. Use two functions. One function will take the input from user and the other will perform the...
Problem 3 (35) Design a calculator that performs four operations: addition, multiplication, division and subtraction with 2 integer type numbers a) Ask user what type of operation to perform (+, , * or/) a. If the user inputs 'none' then the program terminates. Otherwise it will keep continuing the calculation. (hint: use while) b) Ask user to provide 2 integer number inputs c) Perform operation (whatever operation they mentioned in a) d) Print result e) In division operation, perform a...
A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers, using your understanding of Java. Description: You need to write a program that will display a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the...
The matrix operations that you should include are Addition, Subtraction and Multiplication. The driver can be as simple as asking the user to enter two matrices and then presenting a simple menu that allows the user to select the operation they want to test. Have the menu in a loop so that the user can test any other operation unless they choose to exit the menu. Also, provide the user an option to select two new matrices. Make sure that...
Write a Python Program that displays repeatedly a menu as shown in the sample run below. The user will enter 1, 2, 3, 4 or 5 for choosing addition, substation, multiplication, division or exit respectively. Then the user will be asked to enter the two numbers and the result for the operation selected will be displayed. After an operation is finished and output is displayed the menu is redisplayed, you may choose another operation or enter 5 to exit the...
Create a web page that will help students practice math - Addition, Subtraction, Multiplication and Division. The page should generate and display a math problem using 2 random numbers from 1 to 12. Addition: [1 - 12] + [1 - 12] = [2 - 24]<-Calculated Subtraction: [2 - 24]<-Calculated - [1 - 12] = [1 - 12] Multiplication: [1 - 12] * [1 - 12] = [1 - 144]<-Calculated Division: [1 - 144]<-Calculated / [1 - 12] = [1 -...
Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for list of operations that can be calculated and get the input from user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations must be...
Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for the list of operations that can be calculated and get the input from the user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations...
Write a C program to implement matrix multiplication operations. First, you need to prompt the user for the size of both matrix. Then take inputs for both matrices and perform matrix multiplication operation. Finally, print the resulting matrix into the output.