forked from usamajay/hacktoberfest2021-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Employee_Print.cpp
106 lines (74 loc) · 1.16 KB
/
Employee_Print.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
98
99
100
101
102
103
104
105
106
#include<iostream>
using namespace std;
class Id
{
protected :
int eid;
public :
void getId()
{
cout<<"Enter Employee Id : ";
cin>>eid;
}
};
class Name : public Id
{
protected :
char ename[100];
public :
void getName()
{
cout<<"Enter Employee Name : ";
//fflush(stdin);
cin.getline(ename,100);
}
};
class Salary : public Name
{
protected :
int sal;
public :
void getSalary()
{
cout<<"Enter Salary : ";
cin>>sal;
}
};
class Duration : public Salary
{
protected :
int dur;
public :
void getDuration()
{
cout<<"Enter Work Duration : ";
cin>>dur;
}
void print()
{
cout<<endl<<"Id : "<<eid<<endl;
cout<<"Employee Name : "<<ename<<endl;
cout<<"Salary : "<<sal<<endl;
cout<<"Duration : "<<dur<<endl;
}
};
int main()
{
int a,l;
Duration d1,d2,d3;
d1.getName();
d1.getId();
d1.getSalary();
d1.getDuration();
d2.getName();
d2.getId();
d2.getSalary();
d2.getDuration();
d3.getName();
d3.getId();
d3.getSalary();
d3.getDuration();
d1.print();
d2.print();
d3.print();
}