/*這個例子很簡單的就把密碼輸入隱藏功能呈現出來,關鍵的一點就是system(“cls”),與大家分享*/
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int ch,i;
int count=0;
char passwd[128];
while((ch=getch())!=13)
{
if(ch==8)
{
system("cls");
for(i=(--count);i>0;i--)
printf("*");
passwd[count]=' ';
}
else
{
printf("*");
passwd[count++]=ch;
}
}
passwd[count]='\0' ;
printf("\nThe password you have inputed is : %s\n",passwd);
getch();
}