Search My BLOG
Free Translater For All Languages
Mobile Phone Location Tracker
phone number location and operator in India
Just enter 10 digits phone number in the search box and click on Trace.
All The Best !!!!!
Thursday, November 12, 2009
C Program To Accept Password
This is a simple login program in C.While accepting password it masks each character using ‘*’ symbaol and display the password in the next line after the user hits Enter key.It also accepts backspaces and acts accordingly.
#include
#include
#include
char pw[25],ch;
int i;
void main()
{
clrscr();
puts(”Enter password”);
while(1)
{
if(i<0)
i=0;
ch=getch();
if(ch==13)
break; /*13 is ASCII value of ENTER*/
if(ch==8) /*ASCII value of BACKSPACE*/
{
putch(’\b’);
putch(NULL);
putch(’\b’);
–i;
continue;
}
pw[i++]=ch;
ch=’*';
putch(ch);
}
pw[i]=’\0′;
printf(”\n\n%s”,pw);
getch();
}
int i;
void main()
{
clrscr();
puts(”Enter password”);
while(1)
{
if(i<0)
i=0;
ch=getch();
if(ch==13)
break; /*13 is ASCII value of ENTER*/
if(ch==8) /*ASCII value of BACKSPACE*/
{
putch(’\b’);
putch(NULL);
putch(’\b’);
–i;
continue;
}
pw[i++]=ch;
ch=’*';
putch(ch);
}
pw[i]=’\0′;
printf(”\n\n%s”,pw);
getch();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment