C++ password

ok..... iam working on password protection for my program but i have some little problems here...

here is my code:::::

[cpp]cout << "PASSWORD: ";
getline (cin,password);
if (password == "my pass")
cout << "Your Choice: ";
cin >> chose;

if (chose == '1')

if (chose == '2')

for (i=0; i<=5; i++)
cout<<"WRONG PASSWORD!!"<<endl;
cout<<"This Program Exiting in "<<sec--<<" seconds...";

char cChar;
return 0;
} [/cpp]

I want after 5 seconds program exit.... and didn't write all the word just the time -1 ....
5 answers Last reply
More about password
  1. I'm no C++ expert, but isn't the Sleep procedure based on the system clock? Won't that mean different times for different systems? :)
  2. Can't remember exactly about the sleep procedure, but most programming languages take time in ms as parameter, so 5000 would be about 5 seconds (yes can vary a bit).

    Can you describe in your own words how you want the soft to behave? And if you can indent the code it would also help.
  3. Dude u can use delay function to do this
    here's the following code for this instead of sleep:
    //header file is <process.h> for exit(0) to close program

  4. Dude, u are almost 3 years late : )
  5. This topic has been closed by Nikorr.
Ask a new question

Read More

Programming Apps