#include<stdio.h>
#include<string.h>
void fun04()
{
for (int i = 0; i < 3; i++)
{
char *str01 = "hello";
char uname[100] ;
printf("请输入账号");
scanf("%s",uname);
char *str02 = "123456";
char pword[100];
printf("请输入密码");
scanf("%s",pword);
if(strcmp(str01,uname) ==0 && strcmp(str02,pword) == 0)
{
printf("登录成功\n");
return 1;
}
else
{
printf("登录失败\n");
if(2-i != 0)
{
printf("你还剩%d次机会\n",(2-i));
}
else
{
printf("账号已被锁定\n");
}
}
}
}
int main(int agrc,const char *agrv[])
{
fun04();
}
登录成功:
登陆失败: