Programming Challenge #4 – Guessing 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:

  1. Display a list of numbers to the screen (random numbers).
  2. Pick one of those numbers at random and start a guessing game
  3. The user must guess the selected number. You must validate that the number the user guessed was valid, and among the choices listed.
  4. Tell the user whether or not the number they guessed is larger or smaller than the number you’re looking for.
  5. 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.

Programming Challenge #3 – Palindromic numbers