题解 | #登录验证#
登录验证
http://www.nowcoder.com/practice/799daf76369c4fb1a2e2d56f885225ae
#include <stdio.h>
int main(){
char a[6]="admin";
char user[100],pwd[100];
int is=1;
scanf("%s %s",user,pwd);
for(int i=0;a[i]!=0;i++){
if(user[i]!=a[i]) {
is=0;
printf("Login Fail!");
break;
}
if(pwd[i]!=a[i]){
is=0;
printf("Login Fail!");
break;
}
}
if(is==1) printf("Login Success!");
return 0;
}
int main(){
char a[6]="admin";
char user[100],pwd[100];
int is=1;
scanf("%s %s",user,pwd);
for(int i=0;a[i]!=0;i++){
if(user[i]!=a[i]) {
is=0;
printf("Login Fail!");
break;
}
if(pwd[i]!=a[i]){
is=0;
printf("Login Fail!");
break;
}
}
if(is==1) printf("Login Success!");
return 0;
}