I am self teaching myself C++, it's been a slow grueling process, but I am making headway. But, unfortunately I am stuck. This has got to be real simple. However I cannot find the how to do it in the tutorial?
Basically, I want to have a line that says "Hit (B) to go back or (X) to exit." and the have a simple conditional: if the key hit equals "B" or "b" then go to line 1 (and of course much the same for "X" or "x").
The cout part isn't a problem. But from what I read every cin command requires that you to hit return to input a value into a variable. I don't want to do it that way. I want to be able to hit one key and immediately upon hitting that key an event happen (exit of the program, go to line 1, etc.). Can somebody tell me how I can accomplish this?
I would greatly appreciate any help anyone can give.
Unfortunately, as far as I know, there is no easy way to do that. The only way I could think of is to directly use the API for your desktop system (e.g. windows.h) to wait for a key press, and then process the key press. In other words, there is not really a way you can do this in "standard" C++ (I could be wrong).