This program will print the * whenever you press any digit and will also omit the last character after pressing the backspace..
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
ptintf("enter the password:\n");
ch=getch();
while(ch!=13)
{
if(ch==8)
{
putch('\b');
putch(NULL);
putch('\b');
}
else
{
printf("%c",ch);
putch('\b');
printf("*");
}
ch=getch();
}
}
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
ptintf("enter the password:\n");
ch=getch();
while(ch!=13)
{
if(ch==8)
{
putch('\b');
putch(NULL);
putch('\b');
}
else
{
printf("%c",ch);
putch('\b');
printf("*");
}
ch=getch();
}
}
No comments:
Post a Comment
Feel free to comment......