Page 402 - C++
P. 402
cin>>clw;
long offset=0;
while(fin.read((char *)&f,sizeof(f)))
{
if(s.cls==clw)
{
f.enterd();
fin.seekp(offset,ios::beg);
fin.write((char *)&f,sizeof(f));
}
offset+=sizeof(f);
}
fin.close();
cout<<"\n\n\t Modified data : ";
f.displayd();
getch();
}
//***********FUNCTION TO DELETE FEE STRUCTURE**************
void DELETE()
{
clrscr();
fstream fin("fee.dat",ios::in|ios::binary);
fstream fout("temp.dat",ios::out|ios::binary);
int clw;
cout<<"\n Enter the Class of the Student whose Fee Structure is to be
Deleted:";
cin>>clw;
while(fin.read((char *)&f,sizeof(f)))
{
if(clw!=s.cls)
{
fout.write((char *)&f,sizeof(f));
}
}
fin.close();
fout.close();
cout<<"\n\n\t Data deleted ";
cout<<"\n\t\7 Press any key to continue";
remove("fee.dat");
rename("temp.dat","fee.dat");
}
//*************FUNCTION FOR FEE COLLECTION*****************
void Fee_collect()
{
clrscr();
int clas,anum,t;
char section;
cout<<" \n\n\t Enter the Admission no : ";
cin>>anum;
cout<<"\n\n\t Enter The Class Of The Student : ";