Is it posibble to have a count-down timer while I'm doing something else in the console? it's a simple game wherein a specified time is allowed for the player..if possible, how? I created a timer but it waits until it finishes before proceding to the game..tnx in advance

Put the timer code in another thread. How to create the thread depends on the operatin system.

so it can be done using multithreading...and i don't even have any idea how to do one! lol...maybe i'll just scrap the timer idea on the game..but tnx anyways for your response

Creating another thread is pretty trivial, depending on the operating system. For example, in MS-Windows just call CreateThread() leaving most parameter values 0.

#include <windows.h>

DWORD WINAPI ThreadProc(void* lpParameter)
{
    // put your timer code here


    return 0;
}

int main()
{
      DWORD ThreadID = 0;
      CreateThread(0,0, ThreadProc, 0, 0, &ThreadID);

}

but we haven't discussed it yet those..I don't have any idea.. and I think it's already an advanced programming... so my professor will understand my situation. Anyway, I revised the game and it still looks fine even without the timer...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.