-
Notifications
You must be signed in to change notification settings - Fork 0
/
House.cpp
69 lines (68 loc) · 965 Bytes
/
House.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
#include<iostream.h>
#include<conio.h>
class house
{
public:
intlen,bre,door,window;
house()
{
len=20;
bre=100;
}
void inputdimension()
{
cout<<"enter the length:";
cin>>len;
cout<<"enter the breadth:";
cin>>bre;
}
void get_door()
{
cout<<"enter the number of doors:";
cin>>door;
}
void get_wind()
{
cout<<"enter the number of windows:";
cin>>window;
}
void display()
{
cout<<"length of the house is: "<<len<<endl;
cout<<"breadth of the house is: "<<bre<<endl;
cout<<"no. of doors in the house are: "<<door<<endl;
cout<<"no. of windows in the house are: "<<window<<endl;
}
};
class doors:public house
{
public:
void doorcost()
{
int c;
c=500*door;
cout<<"cost of doors is: "<<c<<endl;
} };
class windows: public house
{
public:
void windowcost()
{
int w;
w=1000*window;
cout<<"cost of windows is: "<<w<<endl;
}
};
void main()
{
clrscr();
doors d;
windows w1;
d.inputdimension();
d.get_door();
d.get_wind();
d.display();
d.doorcost();
w1.windowcost();
getch();
}