Home > Back-end >  Questions about the time in C language
Questions about the time in C language

Time:10-19

And, more recently, for a freshman in the teacher the assignment, write a small game code, one request to the need to provide the function of the time limit, such as at the end of the countdown one minute after the game, and statistics of the user's score, I don't know how to implement?

CodePudding user response:

Vc MFC with timer

CodePudding user response:

At the start of the game time_t start=time (NULL);
In the process of each game:
If (time (NULL) - start & gt;=60) {
Game_over ();
}

CodePudding user response:

Under Linux has alarm, win32 should also have the API

CodePudding user response:



Consider using multithreading, a thread for timing, one for the score,

CodePudding user response:

Consider using multithreading, a thread for timing, as a thread 1, another thread for processing points, as the thread 2,

CodePudding user response:

SetTimer at that time
  • Related