#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h.>
#include<stdlib.h>
int main()
{
for (int i = 0; i < 3; ++i)
{
char password[100] = { 0 };
printf("请输入密码:\n");
scanf("%s", password);
if (strcmp(password, "123456") == 0)//通过strcmp比较输入密码与初始化密码字符串长度,以此判断正误
{
printf("密码正确\n");
system("pause");
break;
}
else
{
printf("密码错误\n");
}
}
return 0;
}
C语言实现模拟密码登陆程序(三次后强退结束)
最新推荐文章于 2023-06-06 15:18:34 发布