{
protected:
int age,roll;
char bg[5],name[100],dob[15];
public:
int getroll()
{
return(roll);
}
void input1()
{
cout<<"\n enter name::";
gets(name);
cout<<"\n enter age::";
cin>>age;
cout<<"\n enter roll no::";
cin>>roll;
cout<<"\n enter date of birth::";
cin>>dob;
cout<<"\n enter blood group::";
cin>>bg;
}
void disp1()
{
cout<<"\n\n\t\t !!RECORD DETAILS!!";
cout<<"\n\n\t NAME:"<<name;
cout<<"\n\n\t AGE:"<<age;
cout<<"\n\n\t ROLL NO:"<<roll;
cout<<"\n\n\t DATE OF BIRTH:"<<dob;
cout<<"\n\n\t BLOOD GROUP:"<<bg;
}
};
class fig
{
protected:
char ht[10],wt[10];
public:
void input2()
{
cout<<"\n enter height(cms)::";
gets(ht);
cout<<"\n enter weight(kgs)::";
gets(wt);
}
void disp2()
{
cout<<"\n\n\t HEIGHT(cm):"<<ht;
cout<<"\n\n\t WEIGHT(kg):"<<wt;
}
};
class details
{
protected:
char add[200],em[50],mno[15];
public:
void input3()
{
cout<<"\n enter address::";
gets(add);
cout<<"\n enter email id::";
cin>>em;
cout<<"\n enter mobile no::";
cin>>mno;
}
void disp3()
{
cout<<"\n\n\t ADDRESS:"<<add;
cout<<"\n\n\t EMAIL ID:"<<em;
cout<<"\n\n\t MOBILE NO:"<<mno;
}
};
class other:public pers,public fig,public details
{
protected:
char pno[20],lno[20];
public:
void input4()
{
input1();
input2();
input3();
cout<<"\n enter policy no::";
cin>>pno;
cout<<"\n enter license no::";
cin>>lno;
}
void disp4()
{
disp1();
disp2();
disp3();
cout<<"\n\n\t POLICY NO:"<<pno;
cout<<"\n\n\t LICENSE NO:"<<lno;
}
void modify();
};
void other::modify()
{
int h,t;
cout<<"\n which field to modify??";
cout<<"\n 1.name";
cout<<"\n 2.age";
cout<<"\n 3.roll no.";
cout<<"\n 4.date of birth";
cout<<"\n 5.blood group";
cout<<"\n 6.height";
cout<<"\n 7.weight";
cout<<"\n 8.address";
cout<<"\n 9.email id";
cout<<"\n 10.mobile no.";
cout<<"\n 11.policy no.";
cout<<"\n 12.license no.";
do{
cout<<"\n enter ur choice:: (13] Done)";
cin>>t;
switch(t)
{
case 1:cout<<"\n enter name::";
gets(name);
break;
case 2:cout<<"\n enter age::";
cin>>age;
break;
case 3:cout<<"\n enter roll no::";
cin>>roll;
break;
case 4:cout<<"\n enter date of birth::";
cin>>dob;
break;
case 5:cout<<"\n enter blood group::";
cin>>bg;
break;
case 6:cout<<"\n enter height(cms)::";
gets(ht);
break;
case 7:cout<<"\n enter weight(kgs)::";
gets(wt);
break;
case 8:cout<<"\n enter address::";
gets(add);
break;
case 9:cout<<"\n enter email id::";
cin>>em;
break;
case 10:cout<<"\n enter mobile no::";
cin>>mno;
break;
case 11:cout<<"\n enter policy no::";
cin>>pno;
break;
case 12:cout<<"\n enter license no::";
cin>>lno;
break;
}
}while(t!=13);
}
void main()
{
clrscr();
int f,d,i=0,flag,h,y,z;
char ch;
other o[30];
do
{
clrscr();
cout<<"\n\t MENU ";
cout<<"\n 1.insert record";
cout<<"\n 2.delete record";
cout<<"\n 3.modify record";
cout<<"\n 4.display";
cout<<"\n 5.search";
cout<<"\n 6.exit";
cout<<"\n enter ur choice::";
cin>>f;
switch(f)
{
case 1: o[i].input4();
i++;
break;
case 2: flag=1;
clrscr();
cout<<"\ntotal no of record =>"<<i;
cout<<"\n\n\n enter RECORD no to delete::";
cin>>d;
if(d>0 && d<=i)
flag=0;
else
flag=1;
if(flag==0)
{
delete(&o[d-1]);
for(y=d;y<=i;y++)
{
o[y-1]=o[y];
}
delete(&o[y-1]);
i--;
cout<<"\n record deleted";
}
else
cout<<"\n record does not exist";
break;
case 3: int p;
clrscr();
cout<<"\n\n\n enter ROLL NO. u wanna modify";
cin>>d;
for(p=0;p<i;p++)
{
if(o[p].getroll()==d)
o[p].modify();
}
cout<<"\n record does not exist";
break;
case 4: clrscr();
for(z=0;z<i;z++)
{
o[z].disp4();
getch();
clrscr();
}
break;
case 5: flag=1;
clrscr();
cout<<"\n\n\n enter the ROLL no.::";
cin>>d;
for(p=0;p<i;p++)
if(o[p].getroll()==d)
{
cout<<"\nRESULT FOUND->>.>";
o[p].disp4();
}
// cout<<"\n record does not exist";
break;
case 6: exit(0);
default: cout<<"\n !!wrong choice!!";
}
}
while(f!=6);
getch();
}
No comments:
Post a Comment