forked from Backslash-Computing-Society/Hacktober
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprac2.cpp
More file actions
49 lines (47 loc) · 706 Bytes
/
prac2.cpp
File metadata and controls
49 lines (47 loc) · 706 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
49
#include<iostream>
using namespace std;
class divfloat;
class divint{
int a,b;
public:
void set(int x, int y)
{
a=x;
b=y;
}
friend void div(divint p,divfloat q);
};
class divfloat{
float c,d;
public:
void set(float x, float y)
{
c=x;
d=y;
}
friend void div(divint p,divfloat q);
};
void div(divint p,divfloat q)
{
int divz = p.a/p.b;
cout<<"Integer Quotient:"<<divz<<endl;
float divf = q.c/q.d;
cout<<"Float Quotient:"<<divf<<endl;
}
int main()
{
int n1,n2;
float f1,f2;
divint z;
divfloat f;
cout<<"Enter first number:";
cin>>n1;
cout<<"Enter second number:";
cin>>n2;
f1=(float)n1;
f2=(float)n2;
z.set(n1,n2);
f.set(f1,f2);
div(z,f);
return 0;
}