-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.cpp
More file actions
37 lines (36 loc) · 646 Bytes
/
calculator.cpp
File metadata and controls
37 lines (36 loc) · 646 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
29
30
31
32
33
34
35
36
37
#include<iostream>
using namespace std;
int main()
{
char a;
float x, y, res;
cout << "Enter the first digit :";
cin >> x;
cout << "Enter the Second Digit : ";
cin >> y;
cout << "Enter the expression (+,-,* or / ) : ";
cin >> a;
switch (a)
{
case '+':
res = x + y;
cout << "The Sum is : " << res;
break;
case '-':
res = x - y;
cout << "The Difference is : " << res;
break;
case '*':
res = x * y;
cout << "The Product is : " << res;
break;
case '/':
res = x / y;
cout << "The Division is : " << res;
break;
default:
cout << "Invalid Condition";
break;
}
return 0;
}