Just started a C++ course and I was told to change the calculator I just made into a guessing my favorite number, if the answer is not correct the computer is not supposed to do anything.
I can't find any instruction on this and am pretty clueless on what to do.
You're going to need a way of generating a random integer in a range of values.
Here's some pseudopseudocode that may or may not be right:
START INFINITE WHILE LOOP
- Generate a random number in a certain range (say, 1-10).
- Print random number.
- bool MATCH = Prompt user for TRUE/FALSE match of favorite number
- IF (MATCH == TRUE) {"COMPUTER READS YOUR MIND"; BREAK;}
ELSE {// DO NOTHING AND REPEAT NEXT ITERATION OF THE LOOP}
END INFINITE WHILE LOOP
That should at least get you going. I don't code C++, so you're on your own. I did this shit back when I was 15, and it's a good indicator if you're cut out to be a codemonkey. Make sure your variables are integers, generate a random number that's an integer, etc.