-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut42.cpp
More file actions
48 lines (45 loc) · 1012 Bytes
/
Copy pathtut42.cpp
File metadata and controls
48 lines (45 loc) · 1012 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
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
using namespace std;
class simcalcu
{
public:
int a, b;
char p;
void getvalue()
{
cout << "Enter the value a: " << endl;
cin >> a;
cout << "Enter the value b: " << endl;
cin >> b;
cout << "Choose an operator" << endl;
cin >> p;
}
void operation()
{
switch (p)
{
case '+':
cout << "The additon of the number is: " << a + b << endl;
break;
case '-':
cout << "The substraction of the number is: " << a - b << endl;
break;
case '*':
cout << "The Multiplication of the number is: " << a * b << endl;
break;
case '/':
cout << "The Division of the number is: " << a / b << endl;
break;
default:
cout << "Error! operator is not correct";
break;
}
}
};
int main()
{
simcalcu d;
d.getvalue();
d.operation();
return 0;
}