noob help on simple program
ive just started learning c++, im still in high school so i dont do it constantly, and im using the bloodshed compiler. I wrote this program and its not working quite as i had hoped. Here is the code.
Code:
#include <iostream>
using namespace std;
int main()
{
cout<<"Enter Password: ";
string password;
cin >> password;
getline(cin, password ,'\n');
if (password=="lala") {
cout<<"Access Granted";
_sleep ( 3000 );
}
else {
cout<<"Access Denied\n";
_sleep(1000);
cout<<"Closing Program\n";
_sleep(1000);
}
}
when running the program it will ask you for a password and when u enter "lala" the correct password it says access denied, then closing program, then it closes as if it was wrong. I looked over the code plenty of times and cant quite figure out the problem. pls help.