-
Notifications
You must be signed in to change notification settings - Fork 3
/
calculator.cpp
46 lines (34 loc) · 931 Bytes
/
calculator.cpp
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
40
41
42
43
44
45
46
#include <iostream>
using namespace std;
int main(){
float a , b ;
char y;
cout<<"WELCOME TO CALCULATOR \n\n";
cout<<"Enter Both number : ";
cin>>a>>b;
label:
cout<<"Enter the operation you want to perform : \n'+'for addition , '-' for subtraction , '*' for multiplication , \n'%' for modulus , '/'for division\n";
cin>>y;
switch (y)
{
case '+':
cout<<"Addition is : "<<a+b;
break;
case '-':
cout<<"Subtraction is : "<<a-b;
break;
case '/':
cout<<"Division is : "<<a/b;
break;
case '%':
cout<<"Remainder is : "<<int(a)%int(b);
break;
case '*':
cout<<"Multiplication is : "<<a*b;
break;
default:
cout<<"\nERROR : Wrong operation input \n\n";
goto label;
}
return 0;
}