密碼設定及檢查的程式
#include <stdio.h>int main(void)
{
char password;
char again;
int x;
printf("Enter 5 letters for password:\n");
gets(password);
printf("Enter your password again:\n");
for(x=0;x<5;x++)
{
again=getch(); //getch()並不會顯示所輸入的字元在螢幕上。
putchar('\*');
}
printf("\n");
if(!strcmp(password,again)) printf("Password is correct.\n");
else printf("Not match.\n");
return 0;
}
頁:
[1]