密码输入代码
# define _CRT_SECURE_NO_WARNINGS
# include<stdio.h>
# include<stdlib.h>
int main(void)
{
char passward[] = "12345abc";
char shuru[20];
int i;
for (i = 0; i <= 2; i++)
{
printf("请输入密码:->");
scanf("%s", &shuru);
if ((strcmp( shuru,"12345abc")) == 0)
{
printf("登陆成功!\n");
break;
}
else
{
printf("密码不正确! ");
}
}
if (i > 2)
printf("输入密码次数已用完,登陆失败!\n");
system("pause");
return 0;
}
输入不正确时,输出结果为
输入正确时输出结果为