So I've been watching some of the CS50 Computer Science lectures/trying the problem sets but for Problem set 1 I can't get a Do while loop to work - I've tried loads of different ways but I either end up with it just saying "number too low" an infinite amount of times or the target number starts to chancge

I never really did sit down and learn C++ but I have done enough programming to debug some code. Just throwing that out there.

It looks like you have stumbled upon an infinite loop using the do while. If you are trying to set up the variable n equal to the function, as in you want to fill the skittles jar, You don't want to fill the jar every time you run the loop waiting for the right answer. Define the variable outside of the loop and then have a checker function to compare the guessed number to the variable n.

If you are looking to show off a bit and also make it a bit easier for the end user to guess you could always add a list of previously guessed answers. Probably just have to define a list and fill it with items. You can just tag that to the end of your loop before it goes back to the beginning and lets the user try again. The output of the list would be near the beginning of the loop.

If you want to have fun and show off write an algorithm that generates a psuedo random number and that guesses it in as little guesses as possible.

Hint: you should be able to do this logarithmically and binary search like

EDIT: or better yet write a program that makes you mentally choose a number between 1-5,000, and guesses your number in less than 13 guesses (it should always guess correctly and never miss by it's 13'th guess), on every guess it would present a number and have 3 options:1: this is greater then my number2: this is less then my number3: this is my number

"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein

my suggestion would be easy enough for a newcomer to programming but your idea sounds much more intriguing, i may have to pick up a compiler and start playing because of what you just said. it's been far too long.