Sunday, April 29, 2012

PASSWORD entry model- C program

// program for how **** are displayed when you type anything
// in the PASSWORD box


#include stdio.h #include conio.h int main() { int i=0; char ch,pass[10]; clrscr(); puts("enter password (max 10 characters wide) \n"); puts("only digits and characters are allowed "); puts("\n enter here- "); while((ch=getch())!='\r') //until ENTER is pressed { if(isalnum(ch)) { putchar('*'); pass[i++]=ch; } } pass[i]='\0'; printf("\n entered password is- %s",pass); getch(); return 0; }

No comments:

Post a Comment