-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharsh.cpp
97 lines (89 loc) · 2.05 KB
/
harsh.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <iostream>
#include <string>
using namespace std;
class member{
char name[20], address[40];
double number;
int age;
public:
int salary;
void input()
{ cout<<endl;
cout<<"Name : "<<endl;
cin.getline(name, 20);
cout<<"Age : "<<endl;
cin>>age;
cout<<"Phone Number : "<<endl;
cin>>number;
cout<<"Address : "<<endl;
cin.getline(address, 40);
cout<<"Salary : "<<endl;
cin>>salary;
}
void display()
{ cout<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Age : "<<age<<endl;
cout<<"Phone Number : "<<number<<endl;
cout<<"Address : "<<address<<endl;
cout<<"Salary : "<<salary<<endl;
}
};
class employee : public member{
char specialization[20], department[20];
public:
void input()
{
cout<<"\n \t Enter Employee Details \t \n";
member::input();
cout<<"Specialization : "<<endl;
cin.getline(specialization, 20);
cout<<"Department : "<<endl;
cin.getline(department, 20);
}
void display()
{
cout<<"\n \t Displaying Employee Details \t \n";
member::display();
cout<<"Specialization : "<<specialization<<endl;
cout<<"Department : "<<department<<endl;
}
void printSalary()
{
cout<<"\n Salary of the member is : "<<salary<<endl;
}
};
class manager : public member{
char specialization[20], department[20];
public:
void input()
{
cout<<"\n \t Enter Manager Details \t \n";
member::input();
cout<<"Specialization : "<<endl;
cin.getline(specialization, 20);
cout<<"Department : "<<endl;
cin.getline(department, 20);
}
void display()
{
cout<<"\n \t Displaying Manager Details \t \n";
member::display();
cout<<"Specialization : "<<specialization<<endl;
cout<<"Department : "<<department<<endl;
}
void printSalary()
{
cout<<"\n Salary of the member is : "<<salary<<endl;
}
};
int main()
{
employee e;
manager m;
e.input();
m.input();
e.display();
e.printSalary();
m.display();
m.printSalary();