forked from codebloded/BackToBasics.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject1Calc.cpp
More file actions
64 lines (57 loc) · 1.15 KB
/
project1Calc.cpp
File metadata and controls
64 lines (57 loc) · 1.15 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include<iostream>
using namespace std;
class SimpleCalculator{
protected:
int a;
int b;
public:
//Function Prototype
void utility(float, float);
};
void SimpleCalculator::utility(float x, float y)
{
a=x;
b=y;
int opt;
do
{
cout<<"1.ADDITION"<<endl;
cout<<"2.SUBTRACTION"<<endl;
cout<<"3.DIVISION"<<endl;
cout<<"4.MULTIPICATION"<<endl;
cout<<"5.EXIT"<<endl;
cout<<endl;
cout<<"Enter the operation"<<endl;
cin>>opt;
if (opt==6)
{
break;
}
switch(opt)
{
case 1:
cout<<"The addition is :"<<a+b<<endl;
break;
case 2:
cout<<"The subtraction is :"<<a-b<<endl;
break;
case 3:
cout<<"The division is :"<<a/b<<endl;
break;
case 4:
cout<<"The product is :"<<a*b<<endl;
break;
case 6:
cout<<"INVALID"<<endl;
break;
default:
cout<<"EXITING ...."<<endl;
}
} while(opt!=5);
}
int main()
{
SimpleCalculator calc;
calc.utility(1067.0,78.9);
return 0;
}