Topics Discussed: Making a simple number guessing game
Tag Archive for Game
Code difficulty: 4/10
Math difficulty: 2/10
In his challenge I ask that you do the following things:
Create a program that will:
- Display a list of numbers to the screen (random numbers).
- Pick one of those numbers at random and start a guessing game
- The user must guess the selected number. You must validate that the number the user guessed was valid, and among the choices listed.
- Tell the user whether or not the number they guessed is larger or smaller than the number you’re looking for.
- After a certain number of guesses, the user loses and gets prompted to try again.
Concepts used: Functions, variables, loops, random functions, returns, boolean, vectors / lists / arrays, template class member functions, stringstream
You should be able to do this by: Lesson 40
My solution: Not completed yet
–Note: This solution contains spoilers.
Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.