Hi. I have this code, which is working well, but when I prompt the user to input either sentinel value or any key to continue, they have to press enter for the compiler to do anything. Can I make it so they don't have to press enter, or no??
You can't, unless you get into the platform specific libraries, like the WinAPI. In general, just don't worry about it. If you REALLY want something, though, I'm happy to work out something (assuming Windows).
Oh, well darn the luck then. I'm not sure what happened, but the program was working fine and now any key closes the console. Any idea how to make sure it keeps open if the value isn't 0?
Try inputting into a string rather than an int, and then compare the string for if it isn't 0. Otherwise, if you enter a letter cin simply won't change the value of exit, and it will quit because the default value of exit is 0 (the sentinel value)
Thanks. Now that's fixed, but I have one more rookie question. Sorry:/. I changed the code so that 1 is to exit and 0 is remain in the program. The program prints from the beginning,
Enter the players number.
. But after inputting requested data, I'm given the error message. Why isn't the program continuing beyond this point the second time around?