Hey everyone. Okay, I've been digging through a multiplicity of books, watching videos, and reading beginner tutorials on websites. I think that perhaps one of the most confusing aspects of C++ for me is one man's definition of "beginner" when compared to another's. Also, when people say "you can do this but it isn't really used anymore" and then they fail to give an example of what WOULD be used to substitute for what can be done but "isn't anymore," it leaves much to be desired. I'm approaching learning C++ from the perspective of game development, by the way. I'm starting a game dev. program at a local community college in January, so I'm trying to get into this stuff before I HAVE to.
In my simple little "game" below, the "player" has to guess a number less than 100. You can read the logic and see exactly which numbers yield success and which do not. My question is, if the person gets it wrong, I've got it set up for the program to take them back to a spot I've labeled "beginning". Of all I've read and watched, I've yet to see anyone note anything about goto other than "this isn't used much anymore." If that's the case, then if I were to use it, would it be "looked down upon" as something ancient? If so, what the heck should I use instead of goto? I've tried creating a more complex application -- a virtual soda machine -- and in the application, I have a lot of switches with cases that end with a goto to send the person back to a specific point to re-enter some type of data. Is there a more "correct" or beneficial way of achieving goto?
using namespace std;
int number = 0;
cout << "Please enter an integer under 100. If you guess the right range,"
<< " you win: " ;
cin >> number;
if ((number >= 56) && (number <= 78))
cout << "
" << endl;
cout << "
You LOSE!!! Try again...
" << endl;
One more quick question... how would I go about making the console change colors every second while sitting on a cout of something like "YOU WIN!!"?
Thanks for your time.