Answer to Question #57124 in C++ for Eman

Question #57124
how to delete a record from a txt file,I have been created the function but it doesn't work correctly
the function as following:
void DeleteRecord()
{
ReadRecord(); //for the function which I created to read a file
for(int i=0;i<counter;i++)
{
cout<< IDNum[i]<<"\t"<<FullName[i]<<"\t"<<LastName[i]<<"\t"<<phone[i]<<"\t"<<Nationality[i]<<endl;
}
int Id;
int num;
int c=0;
int index=-1;
cout<<"please enter the Id number to be deleted"<<endl;
cin>>Id;
int i;
for ( i=0; i<counter;i++)
{
if ( IDNum[i]==Id)
IDNum[i]==-1;
else
cout<<"ID not valid"<<endl;


}
so please I just want to fix this error

Regards,
Eman
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS