code.club

 找回密碼
 立即註冊
搜索
查看: 7938|回復: 0
打印 上一主題 下一主題

密碼設定及檢查的程式

[複製鏈接]
跳轉到指定樓層
樓主
發表於 2015-1-16 20:37:17 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
#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;
}
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

小黑屋|手機版|Archiver|code.club  

GMT+8, 2024-4-25 10:10 , Processed in 0.089121 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表