# include<stdio.h> #include<windows.h> #include<string.h> int main() { int i = 0; char passwd[10] = { 0 }; for (i = 0; i < 3; i++) { printf("请输入密码:>"); scanf_s("%s", passwd); if (strcmp(passwd, "123456") == 0) { break; } } if(i == 3) printf("登陆失败,退出系统\n"); else if (i < 3) printf("登陆成功\n"); return 0;
}