Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i=0,flag=1;
cout<<"Enter the password.";
char Pass[8],pass[]={"PASSWORD"};
while ( (i<8) && (flag==1) )
{
Pass[i]=getch();
if(Pass[i]=='\b') {i-=1;cout<<"\b";}
if(Pass[i]=='\r') {flag=0;cout<<"\b";}
cout<<"*";
i++;
}
getch();
if(strcmpi(Pass,pass)==0)
cout<<"\nAccess Granted!";
else cout<<"\nDenied.";
getch();
}
When I input the password, the Backspace and the Ebter keys are not working as they should. Please help.
Also, I want to know if I can press enter only once to input the password, not twice.

Thanks a ton!! Really Appreciate the help.
Compiler is Turbo C++ 3.0 on Windows 7.(I am a new student)