does anybody know the source code of program password in turbo C?
#include%26lt;stdio.h%26gt;
main()
{
char password,ppp;
printf("password:");
scanf("%s",%26amp;ppp);
if(password==ppp)
printf("correct");
else
printf("wrong");
getch();
}
this is a wrong one
Does anybody know the source code of program password in turbo C?
there is no direct way to get password chars as "*********" in turbo c. if you need this you have to do it by yourself. i mean you have to get input from user one character at a time and print them as " * ".
Here's a demo:
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
main()
{
char c;
char ppp[20] = "my_password"; // correct password
char password[20];
int cnt=0;
printf("password:");
while( (c=getch()) != 13 ) // 13 is the code for enter
{
password[cnt] = c;
printf("*");
cnt++;
}
password[cnt] = '\0';
if(password==ppp)
printf("correct");
else
printf("wrong");
getch();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment