Welcome to the new platform of Programmer's 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 its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Loop until keypress? How to detect keystroke?
I am currently working on a random number generator for a class project.
I am having no problem with the random number generation part. However there
is one program requirement that I am having a problem with. The program
must loop until a user presses a key, upon which time the current random
number is then displayed. Then when the user presses a key again the program
must restart the loop again. I'm assuming he want's us to use an EOF to
end the program. I'm pretty sure that I'll use a while loop to fulfill the
Here is the question though: Is there a specific function in a library
to detect an event such as a keypress or can anyone give me a push in the
right direction i.e. do I have to write my own function? (I don't need a
complete solution, I can figure it out on my own if I just have an idea where
to look.) I'm using book by Deitel called C++ Learning to Program and I just
can't seem to find anything regarding the eventhandlers if thats even what
they are called in C++.
0 · ·