Hi. I want to write a program that, for example, picks a number and keeps that value until I guess it and then asks if I want to play again at which point (if i picked yes) it picks a new variable. I can get a rand number but not a new one. I am using xcode for mac. why does this not work:
It IS the problem. As it is now randnumb has only one possible value.
You also might want to change usrguess to something outside the range when you choose to play again so that the user don't get right before start guessing. guessplus should also be restored.
Im sorry if that sounded disrespectful. I thought you meant how i wrote that line. I know that it only has one value, so where do i put srand and randnumb so that it changes it value at the start of the first loop? and what do you mean by changing usrguess? once again it sounded like you were attacking how I wrote that line so I am sorry. I would be grateful if you would still help me
I don't think you get it. 10+rand()%1; can only be 10 no matter what value rand() return.
what do you mean by changing usrguess?
This is unrelated to your other problem but if you choose to play again and randnumb happens to be the same as before it will jump straight to the "Congratulations" again without having to guess.