How would i put an amount of time that a user has to input something? Then use the if, else if and what not to determine what happens. Go by the system clock i assume? What function would that be?
I want to make a trivia game where you only have a certain amount of time to answer, and u gain, or lose points depending on if your right or not.
With standard function I don't know if you can.
It certainly would be easier if you used event polling in SDL.
it is not possible on the console without much ugly, complicated, and non-portable coding.
Save the time before the CIN, and after the CIN, get the current time. Take the difference in times. If the time took too long, no points.
Dino's suggestion is a good and portable one. If you really want to read with timeout from the standard input, you're looking at non-portable, OS-specific solutions, and most likely, you will have to deal with the input processing (what to do with backspace, arrow keys and so on) as well.
There is a FAQ called something like "How do I get input without the user hitting Enter?" which goes through a few of the different options of "reading input in raw mode". I have a feeling it also covers "has a key been pressed".