登录密码(可输三次)

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main()
{
 int i = 0;
 for (; i < 3; i++)
 {
  char password[1024] = { 0 };
  printf("请输入密码:");
  scanf("%s", &password);
  if (strcmp(password, "888888") == 0)
  {
   printf("登录成功!\n");
   break;
  }
  else {
   printf("您的输入有误。\n");
  }
  if (i == 3){
   printf("您已经输错三次了\n");
  }
 }

 system("pause");
 return 0;
}

posted @ 2020-03-27 20:41  听说在北郭  阅读(193)  评论(0)    收藏  举报