-
Notifications
You must be signed in to change notification settings - Fork 0
/
5_7.cpp
75 lines (69 loc) · 1.06 KB
/
5_7.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "iostream"
using namespace std;
class Land;
class Tile
{
int l, w, area2, no_of_tile;
public:
void read();
void print();
void area();
void no_of_tiles(Land l);
};
class Land
{
int length, width;
int area1;
friend void Tile::no_of_tiles(Land l);
public:
void read();
void print();
void area();
};
void Land::read()
{
cout << "enter length and breadth";
cin >> length >> width;
area();
}
void Land::print()
{
cout << length << endl
<< width << endl;
}
void Land::area()
{
area1 = length * width;
}
void Tile::area()
{
area2 = l * w;
}
void Tile::read()
{
cout << "enter length and breadth of tile";
cin >> l >> w;
area();
}
void Tile::print()
{
cout << l << endl
<< w << endl;
}
void Tile::no_of_tiles(Land l1)
{
cout << l1.area1 << " \t" << area2 << endl;
no_of_tile = l1.area1 / area2;
cout << no_of_tile << endl;
}
int main()
{
Land l1;
Tile t1;
l1.read();
t1.read();
l1.print();
t1.print();
t1.no_of_tiles(l1);
return 0;
}