ok iam working on a password protection for my program but i have a problem.....
if the user set wrong password the program do this
Wrong password!!
The program will be terminated in 5 seconds
but i want sec, (which is my seconds) at every second - 1
5-4-3-2-1 without present all the "the program will......"
here is my code:::
int main() //main
{
system("color 01c");
char chose;
char option;
int i,sec=5;
string password;
cout<<"THIS PROGRAM IS LOCKED!!"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"PASSWORD: ";
getline (cin,password);
if (password == "my pass")
{
menu();
cout << "Your Choice: ";
cin >> chose;
if (chose == '1')
{
menu2();
}
else
if (chose == '2')
menu3();
}
else
for (i=0; i<=5; i++)
{
cout <<"WRONG PASSWORD!!"<<endl;
cout <<"The program will be terminated in "<<sec--<<" seconds...";
Sleep(5000);
return 0;
}
char cChar;
std::cin.get(cChar);
return 0;
}