Hi everyone, im programing an agenda in c++ but im having a little trouble erasing an entry. Sorry the code is long, i was too lazy to use call functions... anyways bear with me.
i tried setting the value to NULL on the entry i want to erase but that doesnt work, someone told me to change it to "0", but that doesnt work either. any advice please?.

the code was too long so i had to upload the cpp file mediafire


so sorry

4 Years
Discussion Span
Last Post by Lerner

If you change it to NULL or ZERO or '0', you still need to make your code recognize that value means the spot is available for more data or "empty".


string nom[100];
int num[100];
int cla[100];

With the method used to specify the arrays, it's impossible to actually delete an entry in the array. It seems from
your code that I briefly looked at, you're sorting the arrays, performing a binary search for a particular item
and if found you want to delete it.

Seeing as you're sorting the arrays, possibly the easiest solution to implement would be to overwrite the data for the
'deleted' items with the data from either the previous or next array items, meaning that you'd just have duplicate entries
in the array.


I agree with both of the other responder and would add, if this isn't a homework assignment, ask yourself if an array is the best container for you to use.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.