Do you know how I can I move what I have located using my loop to the back of the array and have it be array = ""; So when the array see's the space it just ignores it?
I'm a structure for the first time which seems to be making this harder to think about right now. If I put it after the loop how will I know what the index is? I'm trying to think of a general way because I will have different numebers that the user wants to be "DELETED" so to speak. How do I move the index to be deleted to the back of the array. and make it like arry = ""; as was suggested to me. I don't understand thease ideas.
// remove entry at position_of_item_to_remove
// by moving everything after it to the left by one position
// and return new (logical) size of array
int remove( infoType tele, int& size, int position_of_item_to_remove )
for( int i = position_of_item_to_remove + 1 ; i < size ; ++i ) tele[i] = tele[i-1] ;
1 2 3 4 5 6 7 8 9 10 11 12 13
if( tele[index].phone.compare(dPhone) == 0 )
cout << "The entry to be deleted is " << endl;
// remove the entry at position index
int new_size = remove( tele. size, index ) ;
found = true;
> JLBorges, I think you've gotten things the wrong way around in your remove function -
> you're actually shifting everything to the right. The statement in your for loop should be:
> tele[i-1] = tele[i]