It's a phone book program.
Takes number, name, and address and saves them to addressbook.txt. It has add, search and delete functions. I got all but delete.
Here's the search function(works):
void search(){
char num[50];
char search[50];
ifstream input;
input.open("addressbook.txt");
cout << "Enter phone number: ";
cin >> num;
while(!input.eof()){
input.getline(search, 50);
if(strcmp(num, search)==0){
for(int i=0; i<3; i++){
cout << search << endl;
input.getline(search, 50);
}
}
}
}
And I need to write a function that will delete an entry (3 lines).
void dlete(){
char num[50];
char search[50];
fstream input;
input.open("addressbook.txt");
cout << "Enter phone number: ";
cin >> num;
while(!input.eof()){
input.getline(search, 50);
if(strcmp(num, search)== 0){
input.getline(search, 50);
//???????
}
}
}
For some reason I can't figure out how to get the line, clear it, and repeat.