So I wrote a program for a guess my number game in which I try to guess a number that the computer chooses from 1-100. Now my question is how do I change the code in which me and the computer switch places. So the computer trys to guess a number that I choose.
Here's the code.
*Disclaimer: Code has not been proofread, do not assume is correct*
Now, if you actually read the program, you will see that it always guesses that the answer is 5. The interesting part is how to get the computer to guess something. There's a number of methods that can be used to do this, the simplest methods being to guess a random number, or to just go through all the numbers in order.