Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
In need of some clarity...
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.