Hi, I have spent way to much time stuck on this with no clue how to do it. My program is a phone book directory. I'm writing a funciton that when the user enters a phone number to be deleted the program will delete that corresponding entries info. So it will delete fname, lname, addresss...etc. I have an array. The array is of the type infoType (this is my structure name that so I can have fname....etc.)
I can't delete an entry I have to move it to the end of the array and someone suggested have it at the end this is there quote "Of course by a space I mean nothing as in array[0] = "";" I need help with this issue specificaly I joined this forum just because of it. Please help get this working. I don't even know how to do this. Please give specific examples. I have wasted 3 hours with nothing to show.
Thanks ,
J
//Option D function
void optionD( ifstream &fin, infoType tele[], int& size)
{
int oldSize = 0;
int index = 0;
string dPhone;
bool found = false;
string temp = "";
cout << tele[5].phone;
cout << "You have selected option D " << endl;
cout << "Please enter the phone number of the record to be deleted." << endl;
cin >> dPhone;
while( index < size && !found )
{
if(tele[index].phone.compare(dPhone)== 0)
{
cout << "The entry to be deleted is " << endl;
cout << tele[index].lname << endl;
cout << tele[index].fname << endl;
cout << tele[index].streetAdd << endl;
cout << tele[index].cityStateZ << endl;
cout << tele[index].phone << endl;
found = true;
}
index++;
}
// I need the deletion so to speak to happen here.
}