Page 400 - C++
P. 400
cout<<"\n\t Enter the S.U.P.W fund : ";
cin>>supw;
cout<<"\n\t Enter the term : ";
cin>>sf.term;
}
//***********FUNCTION TO ADD STUDENT STRUCTURE*************
void add()
{
clrscr();
char chh;
fstream fin("student.dat",ios::app|ios::binary);
do
{
s.enter();
fin.write((char *)&s,sizeof(s));
cout<<"\n\t Do U want to enter more records?";
cin>>chh;
}while(chh=='y'||chh=='Y');
cout<<"\n Data has been added on the file";
cout<<"\n\t\7 Press any key to continue..........";
getch();
fin.close();
}
//**********FUNCTION TO DELETE STUDENT STRUCTURE************
void del()
{
clrscr();
fstream fin("student.dat",ios::in|ios::binary);
fstream fout("temp.dat",ios::out|ios::binary);
int r;
cout<<"\n Enter the Admno of the Student whose record is to be deleted:";
cin>>r;
int flag=0;
while(fin.read((char *)&s,sizeof(s)))
{
if(r!=s.retno())
{
fout.write((char *)&s,sizeof(s));
}
else
flag=1;
}
if (flag==1)
cout<<"\n\t Data has been Deleted";
else
cout<<"\n\t No such record.........";
cout<<"\n\t\7 Press any key to continue........";
getch();
fin.close();
fout.close();