I want to make a 20 questions type game. The user thinks of a number between 1 and 100 and by asking questions like "is it even", "is it evenly divisible by five?", and "is it greater than fifty?" the game should narrow it down to one number. I was told that a vector would be the best way to do this (a vector including numbers 1 through 100) but I need help with a couple things.
Would i be able to search through the elements for certain numbers? (like if i needed to eliminate all even numbers, could i search through all the elements to eliminate all of the even ones?)
if I delete an element, do the rest of them move up so if i delete number[3] does number[4] move down to fill the gap where number[3] used to be?
I don't see why you need a vector. Could you implement this using a similar pattern as a binary search? Or do you think that you can do it more efficiently by asking questions other than is it greater or less than x?