#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
main()
{
char pass[100]="happy new year !",g[100];
int i;
start:
printf("輸入密碼 :");
fflush(stdin);
for (i=0;i<19;i++) {
g[i]=getch();
if (i==0 && g[i]==13) exit(0);
if (g[i]==13) {
g[i] = 0;
break;
}
putchar('*');
}
g[i+1] = 0;
printf("\n\n");
printf("你輸入的是 : %s\n",g);
if (strcmp(g,pass)==0) printf("密碼輸入正確!!!\n");
else printf("密碼輸入錯誤!!!\n");
printf("\n\n");
system("pause");
goto start;
}
|