I wanted to make a timer or some number (int) that would decrease in the "background" while the quiz is going on and the user is answering some questions. How can it be done ?
If you run it on your machine enough times you will notice that winning loop and order of win/lose reporting changes
EDIT: I read your revised questing, and answer is the same: create a background thread with timer.
However if you want to interrupt user when time is up, then it is harder. You will need to study how your OS handles input and interact with it directly, as C++ standard streams will not help you here.