题解 | #登录验证#
登录验证
https://www.nowcoder.com/practice/799daf76369c4fb1a2e2d56f885225ae
#include<stdio.h> #include <string.h> int main() { char name[20] = { 0 }; char passage[20] = { 0 }; while (scanf("%s%s",name,passage) != EOF) { const char right_name[] = "admin"; const char right_password[] = "admin"; if( strcmp(name,right_name) != 0) { printf("Login Fail!\n"); } else if(strcmp(passage,right_password) != 0) { printf("Login Fail!\n"); } else printf("Login Success!\n"); } return 0; }