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++.