code.club

標題: 密碼設定及檢查的程式 [打印本頁]

作者: enter    時間: 2015-1-16 20:37
標題: 密碼設定及檢查的程式
#include <stdio.h>

int main(void)
{

char password[4];
char again[4];
int x;
printf("Enter 5 letters for password:\n");
gets(password);
printf("Enter your password again:\n");
for(x=0;x<5;x++)
{
again[x]=getch(); //getch()並不會顯示所輸入的字元在螢幕上。
putchar('\*');
}
printf("\n");
if(!strcmp(password,again)) printf("Password is correct.\n");
else printf("Not match.\n");

return 0;
}




歡迎光臨 code.club (http://code.club/) Powered by Discuz! X3.2