//hospital database. #include #include #include #include #include struct date { int d,m,y; }; class records { protected: char name[15],disease[50]; struct date doa,dod; public: void display(); void getdata(); }; void records::getdata() { cout<<"Enter the name of the patient:"; gets(name); cout<<"Enter the date of admission:"; cin>>doa.d>>doa.m>>doa.y; cout<<"Enter the disease of patient:"; gets(disease); cout<<"Enter the date of discharge:"; cin>>dod.d>>dod.m>>dod.y; } void records::display() { cout<<"\n\n\nName of the patient:\t"; puts(name); cout<<"Date of admission:\t"<>age; } void show() { display(); cout<<"Age:"<>flag; file.write((char *) &a,sizeof(a)); if(flag!=1) break; clrscr(); } file.seekg(0); while(file.read((char *)&a,sizeof(a))) { a.display(); } while(1) { b.get(); cout<<"Enter 1 to continue:"; int flag=1; fileage.write((char*) &b,sizeof(b)); cin>>flag; if(flag!=1) break; clrscr(); } fileage.seekg(0); while(fileage.read((char *)&b,sizeof(b))) { if(b.age<=12) b.show(); } file.close(); fileage.close(); getch(); }