提交 115b8e92 编写于 作者: 独孤过's avatar 独孤过 提交者: Gitee

删除文件 tool

上级 5ff22d2c
#include <string.h>
#include <stdio.h>
#include <conio.h>
static inline int max(int left, int right)
{
return left > right ? left : right;
}
const char *PASSWORD = "universe";
int main()
{
printf("请输入密码:\n");
char password[10];
int length = strlen(PASSWORD);
int counter = 0;
int key;
while (key = getch())
{
password[counter] = key;
if (key == '\b')
{
printf("\b \b");
--counter;
counter = max(counter, 0);
}
else
{
if (key == '\r' || key == '\n')
break;
putchar('*');
++counter;
if (counter >= length)
break;
}
}
password[counter] = '\0';
if (strcmp(password, PASSWORD) == 0)
printf("\n验证通过!");
else
printf("\n密码错误!");
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册