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

http://www.mediafire.com/?x6z64wsa39qpw2u

so sorry

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.