#include <stdio.h>
#include <string.h>
int main()
{
char password[20] = { 0 };
int i = 0;
for (i = 0; i < 3; i++)
{
printf("请输入密码:");
scanf("%s", &password);
if (strcmp(password , "123456") == 0)
{
printf("登入成功\n");
break;
}
else
{
printf("输入密码错误,请重新输入:\n");
}
}
if (i == 3)
{
printf("三次密码均错误,退出程序\n");
}
return 0;
}
标签:include,验证,int,密码,printf,三次,password,输入
From: https://blog.51cto.com/u_16168351/6541222