forked from dharmanshu1921/Website-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalcul2.cpp
More file actions
48 lines (39 loc) · 861 Bytes
/
calcul2.cpp
File metadata and controls
48 lines (39 loc) · 861 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;
int add(float p,float q)
{
return p+q;
}
int sub(float p,float q)
{
return p-q;
}
int prod(float p,float q)
{
return p*q;
}
int quot(float p,float q)
{
return p/q;
}
int main()
{
cout<<"CALCULATOR";
int a;
float b,c,x,y,z,w;
cout<<"\n1. addition\n2. Subraction\n3. Multiplication\n4. Divison\nEnter your choice: ";
cin>>a;
cout<<"Enter number 1: ";
cin>>b;
cout<<"Enter number 2: ";
cin>>c;
switch(a)
{
case 1: a == 1; x = add(b,c); cout<<x; break;
case 2: a == 2; y = sub(b,c); cout<<y; break;
case 3: a == 3; z = prod(b,c); cout<<z; break;
case 4: a == 4; w = quot(b,c); cout<<w; break;
default: cout<<"Enter a valid number";
}
return 0;
}