I am making a program called Perfectlunch, where you input foods, and the amount of items in lunch, and it makes a lunch. But the problem is that sometimes it lists things twice. So can someone tell me how to make a redundancy checker for lists?
Offline
Offline
Thanks, but I need to check if there are two of the same item of the thing in a list.
Offline
Like this?
Offline
JeanTheFox wrote:
http://i55.tinypic.com/2zsybo9.png
Like this?
I don't think that would work, unfortunately. If you want to check for duplicates, I think you have to find the first instance of the item, delete it, then check for other instances, delete those also, and finally put the first instance back where it was.
Offline
If you're having a list that contains the items in the lunch, make it check if a food's already in the list before adding it. Something like this:
It only adds a food to the lunch if it isn't already in there.
Interesting project, by the way.
Offline