Trying to find a phone number if found I want to delete it. It works until it gets to the searching part of the operation. I was getting jibberish phone number outout when I entered the correct number. Now it just seems to sit and wait. Not sure whats up.
Also When I find this number I have to delete it from the array (this is a structure array) not sure if that helps.
What is the easiest way to do this. I would not like to have an empty space in my array. Thanks,
Here is my function
void optionD( ifstream &fin, infoType tele, int& size)
int index = 0;
bool found = false;
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 )
cout << tele[index].phone;
found = true;
This is my array. The size is constant here but I changed it so its not the same when it gets to the function above. I don't know if that helps. infoType tele[SIZE];
I have never talked about pointers in class. Sorry. It is an array.
This is my objective:
Input the phone number from user of the number to be deleted.
Find that number ( which is what I'm having issues with above)
Delete that entire set of information at the specified index when the number is found.
So say that tele is the same phone number as dPhone.
Now I want to delete it from the array and not have a empty space in my array. I just want it gone.
I think that it will just do the statement that is after the if statement?
When I enter the phone number (one that matches) it is the first phone number on my list. It would still output then right? So if it did not and I tried to fix it like the one above your last post so the parenthesis are right. Why wouldn't it output my phone number?