-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.cpp
More file actions
28 lines (23 loc) · 687 Bytes
/
Copy pathcalc.cpp
File metadata and controls
28 lines (23 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
int main()
{
double num1, num2;
char operation;
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the operation you want to perform ('+', '-', '*', '/'): ";
cin >> operation;
cout << "Enter the seond number: ";
cin >> num2;
if (operation == '+')
cout << "The sum is: " << num1 + num2;
else if (operation == '-')
cout << "The difference is: " << num1 - num2;
else if (operation == '*')
cout << "The product is: " << num1 * num2;
else if (operation == '/')
cout << "The qoutient is: " << num1 / num2;
else
cout << "Invalid operation!";
}