//用户登录2022.2.21
#include<stdio.h>
#include<string.h>
int main(){
char name[] = "name";
char userName[20] = {0};
char password[] = "123";
char userPassword[20] = {0};
int i = 0;
for(i;i<3;i++){
printf("请输入账号>");
scanf("%s",userName);
printf("请输入密码>");
scanf("%s",userPassword);
if(strcmp(name,userName)==0&&strcmp(password,userPassword)==0)
{
printf("登录成功\n");
break;
}
else
{
printf("账号或密码不正确\n");
}
}
if(i==3){
printf("输入三次均无效\n");
}
return 0;
}
用户登录的c-code
于 2022-01-21 21:55:40 首次发布