forked from namishkhanna/hacktoberfest2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calculator
39 lines (31 loc) · 762 Bytes
/
Calculator
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
38
39
#include<iostream>
using namespace std;
int main()
{
char op;
float a,b;
cout<<"Enter Operator either + or - or * or / :"<<endl;
cin>>op;
cout<<"Enter Two operands :"<<endl;
cin>>a>>b;
switch(op)
{
case '+':
cout<<a + b;
break;
case '-':
cout<<a - b;
break;
case '*':
cout<<a * b;
break;
case '/':
cout<<a / b;
break;
default:
//If the operator is other than + ,- ,* or / error message is shown
cout<<"ERROR ! operator is not correct";
break;
}
return 0;
}