Deleting sum data from a file

switch (a)
{
case 1:{

system("CLS");
char a[8],b[50],c[50];
char x;

do
{
ofstream myfile("books.txt",ios::app | ios::ate);
if (myfile.is_open())
{ cout<<"\tREGISTER A BOOK"<<endl<<endl;
cout<<"Book ID:";//for user
cin>>a;
myfile<<"Book ID:"<<a<<endl;//writing on file
cout<<"Book Name:";//for user
cin>>b;
myfile<<"Book Name:"<<b<<endl;//writing on file
cout<<"Author:";//for user
cin>>c;
myfile<<"Author:"<<c<<'\n'<<endl;//writing on file

cout<<"Do you want to add more book ? (y/n)\n";
cin>>x;

myfile.close();

}
}
while(x=='y');
break;}

case 2:{
cout<<"\tBooks Deleted\n";
break;


in case 2 I want to view all the books in the file n den delete a particular book

Can any1 build up a code for it???











Topic archived. No new replies allowed.