Sunday 3 February 2013


PasswordGenerator.c:



#include<conio.h>
#include<stdio.h>
#include<ctype.h>

void main(){
char data,password[100]="\0";
int col=25,row=21;
int i=0;
clrscr();
gotoxy(25,20);
printf("Enter the password:\n");
while(1)
{
gotoxy(col,row);
flushall();
data=getch();
if(data!=8) //condition for digit
{
password[i]=data; //convert char to int
printf("*",data);
col++;
i++;
}
if(data==8) //condition for BACK_SPACE key
{
if(col<=25)
col=25;
else
{
col--;
printf("\b");
i--;
clreol();
}

}
else if(data==13) // condition for ENTER key
break;
else if(data==27) //condition for ESC key
break;
flushall();
}
password[i]='\0';
printf("\n\n%s",password); //display number
getch();
}

No comments:

Post a Comment