How to do two things simultaneously

Hello, i have following code and i wanna ask for a right code again but i need the countdown running simultaneously (like somebody is trying figure the code out but there is a countdown running) If i ask for the code in do...while, the countdown will stop until i put the code and thats what i dont want to

#include<iostream>
#include <windows.h>

int main()
{
using namespace std;

cout<<"Insert a code or your data will be deleted:"<<endl;

int i=10;
int code2;
int code = 4185;
cin>>code2;

do
{
cout<<"\a"<<i<<endl;
Sleep(1000);
i=i-1;
}
while(i>5);

do
{
cout<<"\a"<<i<<endl;
Sleep(500);
cout<<"\a";
Sleep(500);
i=i-1;
}
while(i>0);

cout<<"Gotcha:)";


return 0;
}
Please put your code in cod tags so it is easier to read. You could use the conio.h library and use getch(), but only give the use 1 sec to input a code each time.
Topic archived. No new replies allowed.