Write a program to type in password characters
#include<stdio.h>
#include<conio.h>
void main()
{
char password[15],username[15],ch;
int i;
clrscr();
printf("Enter user name: ");
gets(username);
printf("Enter the password: ");
for(i=0;i<10;i++)
{
ch=getch();
password[i]=ch;
ch='*';
printf("%c",ch);
}
password[i]='\0';
printf("\nYour password is: ");
for(i=0;i<10;i++)
printf("%c",password[i]);
getch();
}
Output:
Enter user name: Hanumanth
Enter the password: **********
Your password is: Ladwa
No comments: