--
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class dept
{
int did
char dname[20];
char hod[15];
int nos;
public:void accept()
{
cout<<"enter the dept id";
cin>>did;
cout<<"enter the dept name";
cin>>dname;
cout<<"enter the hod";
cin>>hod;
cout<<"enter the no of staff";
cin>>nos;
}
void display()
{
cout<<"the dept id is-"<
cout<<"the dept name is-"<
cout<<"the hod is-"<
cout<<" the no of staff is-"<
}
}
void main()
{
dept d[5];
int n,i;
clrscr();
fstrean file;
file.open("dept.txt",ios::in|ios::out);
cout<<"enter the no of record you want -";
cin>>n;
for(i=0;i
{
d[i].accept();
file.write((char*)&d[i],sizeof(d[i]));
}
cout<<"\ndetails od department from the file-";
for(i=0;i
{
file.read((char*)&d[i],sizeof(d[i]));
d[i].display();
}
file.close();
getch();
}