-
Notifications
You must be signed in to change notification settings - Fork 0
/
inherit.cpp
189 lines (158 loc) · 3.07 KB
/
inherit.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#include<iostream>
using namespace std;
class base1
{
protected:
char name[50],blood_grp[5];
int dob;
public:
base1()
{
}
};
class base2
{
protected:
int height,weight;
};
class base3
{
protected:
int insurance_policy_number;
char address[50];
};
class inherit:public base1,public base2,public base3
{
int tele_number,driving_license_number;
char delete_re[20];
public:
int cnt,delete_found;
inherit()
{
cnt=0;
}
void accept_i()
{
cout<<"\nEnter the Name :";
cin>>name;
cout<<"\nEnter the Bloog Group :-";
cin>>blood_grp;
cout<<"\nEnter the Date Of Birth :-";
cin>>dob;
cout<<"\nEnter the Height :";
cin>>height;
cout<<"\nEnter the Weight :";
cin>>weight;
cout<<"Enter the Insurance Policy Number :";
cin>>insurance_policy_number;
cout<<"Enter the Contact Address :";
cin>>address;
cout<<"Enter the Mobile Number :";
cin>>tele_number;
cout<<"Enter the Driving License Number :";
cin>>driving_license_number;
cnt++;
}
void module()
{
cout<<"Enter the Name :";
cin>>delete_re;
for(j=0;j<='\0';j++)
if(name[j]==delete_re[j])
{
delete_found=j;
break;
}
else
{
cout<<"No Records Found!!!";
break;
}
}
void dele()
{
cout<<"Enter the Name to Deleted :";
cin>>delete_re;
for(int j=0;j<='\0';j++)
if(name[j]==delete_re[j])
{
delete_found=j;
break;
}
else
{
cout<<"No Records Found!!!";
break;
}
}
void Display()
{
cout<<name<<"\t"<<blood_grp<<"\t"<<dob<<"\t"<<tele_number<<"\t"<<insurance_policy_number<<"\t"<<address<<"\t"<<driving_license_number<<"\n";
}
};
int main()
{
int ch,loop=1,i,temp;
inherit in[30];
inherit inh;
do
{
cout<<"\n1. Insert\n";
cout<<"2. Delete\n";
cout<<"3. Search\n";
cout<<"4. Edit\n";
cout<<"5. Display";
cout<<"6. Exit\n";
cout<<"\n Enter your Choice :";
cin>>ch;
switch(ch)
{
case 1:
{
for(i=0;i<=inh.cnt;i++)
{
in[i].accept_i();
}
}
case 2:
{
for(i=0;i<=inh.cnt;i++)
{
in[i].dele();
}
temp=inh.delete_found;
break;
}
case 3:
{
cout<<"\nName\t Blood Group\t Date of Birth\t Mobile no.\t Insurance policy\t Address\t License no.\n";
cout<<"___________________________________________________________";
for(i=0;i<=b.cnt;i++)
{
in[i].module();
}
up=inh.delete_re;
in[up].Display();
break;
}
case 4:
{
}
case 5:
{
cout<<"\nName\t Blood Group\t Date of Birth\t Mobile no.\t Insurance policy\t Address\t License no.\n";
cout<<"______________________________________________________________________";
for(i=0;i<=inh.cnt;i++)
{
in[i].Display();
}
}
case 6:
{
loop=-1;
}
default:
cout<<"Enter the correct choice";
}
}while(loop==1);
}