-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompany.cpp
61 lines (61 loc) · 816 Bytes
/
Company.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
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class product
{
int id;
char name[20];
public:
void input()
{
cout<<"enter the product id:";
cin>>id;
cout<<"enter the product name:";
gets(name);
}
};
class company
{
intcid;
char cname[20];
public:
void in()
{
cout<<"enter the company id:";
cin>>cid;
cout<<endl;
cout<<"enter the company name:";
gets(cname);
cout<<endl;
}
};
class total_product:publicproduct,public company
{
int quantity;
float price,cost;
public:
void costs()
{
cout<<"enter the price of product: ";
cin>>price;
cout<<endl;
cout<<"enter the quantity of product: ";
cin>>quantity;
cout<<endl;
cost=price*quantity;
cout<<"cost of the product is: ";
cout<<cost<<endl;
}
};
void main()
{
clrscr();
total_productt[2];
for(inti=0;i<2;i++)
{
t[i].input();
t[i].in();
t[i].costs();
}
getch();
}