I'm in a rush for time for this, so any help would be greatly appreciated.
The path I took on a project has led me to now have to check a string entry with previous entries to make sure no repeats exist.
I want to put it in a sort of vector array.
Every time someone enters an author's last name, they have to enter the corresponding books they've written.
And every time they make one entry, they're asked to make another.
Now I want to be able to make sure that they don't try to accidentally enter the same thing twice.
I don't want to have to store values into a txt file or anything.
also i think it might be smart to convert every entry to all uppercase, and check that value.
So if they enter Simon
and then later on enter simon, it will have checked SIMON, with SIMON, and be able to report error...
You could either convert every entry to all uppercase or all lowercase, but either way it would work relatively the same, the only difference would be what you would write to turn "SIMON" ("simon") into "Simon".
I'd say to use a vector that would fill up with author names (authorList) and when the person enters a name (author), it runs through the the vector authorList, checking to see if author == authorList[i];
I tend to avoid writing code during suggestions, but let me know if you need more help than this.
i is the position that it would check inside the vector. Have you ever used vectors? If not, I'd recommend checking out some tutorials. Here is a great place to start:
I would do this:
When you get a book entry,convert to uppercase or lowercase, then compare it to all others in the vector with a for loop. Then if no matches are found, add it to the vector with .push_back()