#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <string.h> int main() { int i = 0; char password[20] = {0}; for( i = 0;i<3;i++) { printf("请输入您的密码,今天是你第%d次输入:",i+1); scanf("%s", password); if (strcmp(password,"123456") == 0) { printf("登录成功"); break; } else { printf("密码错误\n"); } } if (i == 3) { printf("输入错误三次,明天在尝试吧"); } return 0; }
标签:main,语言,int,代码,练习,include From: https://www.cnblogs.com/ayue6/p/17741264.html