-
Notifications
You must be signed in to change notification settings - Fork 0
/
CALCULAT.CPP
46 lines (46 loc) · 880 Bytes
/
CALCULAT.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>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
class sum {
private : float a, b, sum;
char opr;
public:
sum () {
int p, q;
a=p;
b=q;
}
void sumup () {
std::cout<<"Enter Operation A:Addition S: Subtraction M:Multiplication D: Division R:Square Root \nNote!! It Is Case Sensitive Please Us It As Directed\n";
std::cin>>opr;
if (opr=='R') {
std::cout<<"Enter A Number\n";
std::cin>>a;
sum = sqrt(a);
} else {
std::cout<<"Enter Two Numbers\n";
std::cin>>a>>b;
if (opr=='A') {
sum = a+b;
} else if (opr=='S') {
sum = a-b;
}else if (opr=='M') {
sum= a*b;
}else if (opr=='D') {
sum = a/b;
}
else {
std::cout<<"You Have Entered Wrong Operation";
exit(0);
};
};
std::cout<<"Your Awswer Is "<<sum;
}
};
int main () {
sum obj;
obj.sumup();
getch();
return 0;
}