Q:

add a timer c++

# include <windows.h>
# include <iostream>
using namespace std;

void timer(int sec)
{
    Sleep(sec*1000);
}

int main()
{
    cout << "Wait 5 seconds " << endl;
    timer(5);
    cout << "FireWorks !" << endl;

    return 0;
}
1

New to Communities?

Join the community