I don't have any experience with vectors so I'm looking for a little guidance. I don't want the answer, just a direction to take. I've looked up vectors on cplusplus.com but I couldn't understand exactly how they work in order to code them into my program.
Here's my problem.
My program takes numeric user guesses and compares them to a random generated number. If they are wrong, I want to store their guess in an array and output the numbers they've already guessed when the program tells them to guess again.
<random number = 5>
"Take a guess"
<user guesses 6>
"You've guessed: | 6 |"
<user guesses 2>
"You've guessed: | 6 | 2 |"
<user guesses 5>
make any sense?
I don't know how to make the vector an unknown size that can grow and be reset once the random number is reset/they start the game again. I also don't know how to add to the array/vector. I've found .assign() but can't figure out how to use it properly. I've only found it takes a value and repeats it a given number of times.
I'm pretty sure I can figure out how to get the data out just fine with a loop. I've very much new to C++ so I hope I make sense.
Edited 6 Years Ago by SacredFootball: spelling