Hi guys,
need a little help here.
Do anyone here know how to put password into asterisk like (*) from the C coding below?
Thanks and appreciate your help.
Code:
void main()
{
char userid[]="user",password[]="password",p[15],u[15];
int n=1,a,b;
printf("\nEnter username and password below (You have only three chances to enter)");
getch();
while(n<=3)
{
system("cls");
printf("\nUsername: ");
scanf("%s",u);
printf("\nPassword: ");
scanf("%s",p);
a=strcmp(u,userid);
b=strcmp(p,password);
if(a==0&&b==0)
{
printf("\nYou have logged in successfully."); //Put in the main();
break;
}
else
{
printf("\nWrong password and/or username. Now you have % d more chance/s.",3-n);
}
getch();
n++;
}
if(n==4)
printf("\nYou can't log in.");
getch();
}