d'fdf

3 条评论

  • 就是这个

    • include<bits/stdc++.h>
      include <windows.h>
      include <stdio.h>
      include<conio.h>
      include<time.h>
      using namespace std;
      int x = 0;
      int* X = &x;
      char Void[10000] = "\0";
      int Key = 0;
      int KeyOut = 0;
      int User;
      int User2;
      int* Q1;
      int* Q2;
      int* Q3;
      int score; //游戏得分
      const int nn = 809;
      struct Point { int x, y; };
      int dali;
      int fx[4] = { -1,27,1,-27 };
      int fxfx[4][2] = { {0,-1},{1,0},{0,1},{-1,0} };
      int dis[1000][1000];
      int changdi[30][27] = {
      {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
      {0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
      {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
      {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
      {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
      {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
      {0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0},
      {0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
      {0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,0,0,0,3,0,0,0,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
      {2,2,2,2,2,2,1,2,2,2,0,3,3,3,3,3,0,2,2,2,1,2,2,2,2,2,2},
      {0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
      {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
      {0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
      {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
      {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
      {0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0},
      {0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
      {0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
      {0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
      {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
      {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
      {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
      {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
      };
      int xx, xx1, xx2, xx3, xx4, yy, yy5, yy2, yy3, yy4;
      int now, now1, now2, now3, now4;
      int gg1, gg2, gg3, gg4;
      int fangx, nextfx, last1, last2, last3, last4;
      int fenshu, guozi, guaitimer;
      int T1, T2, t1, t2, stopped; //T:计时 t1:玩家速度 t2:怪物速度
      int ff = 0; //f:{0:继续 1:被吃 2:赢了 3:输了}
      int beichi;
      
      define high 20 //定义地图的高度
      define width 30 //定义地图的宽度
      define snake_maxlength 200 //蛇长最大值
      int snake_x[snake_maxlength], snake_y[snake_maxlength]; //蛇的坐标
      int snake_length; //蛇现在的长度
      int Map[high][width] = { 0 }; //初始化地图,0表示空格,1表示蛇身,2表示食物,3表示墙,4表示蛇头,现在地图中什么也没有
      int food_x, food_y; //食物的坐标
      int SCORE; //本局分数
      char input;
      char primeinput = '.';
      int op = 100;
      int Death = 0;
      int Guesstimes;
      struct account{
      char user[1000]; //用户名
      char password[1000]; //密码
      int coin = 0; //硬币
      int number; //编号
      int award = 0; //奖励次数,主要用于恋爱测试器奖励次数的限定
      };
      struct account peo[100]; //初设100人,可更改
      void HideCursor()
      {
      CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
      SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
      }
      float Check(int a)
      {
      if (a == 0) //针对字符和字符串
      {
      float m;
      if (cin >> m)
      {
      return m;
      }
      else
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      while (!(cin >> m))
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      }
      return m;
      }
      }
      else if (a == 1){
      float m;
      float c;
      if (cin >> m){
      while (1){
      if (m == 1 || m == 2 || m == 0){
      return m;
      break;
      }
      else{
      cout << "输入错误,请重新输入:";
      c = Check(1); //递归调用,重新检测输入
      return c;
      break;
      }
      }
      }
      else{
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      while (!(cin >> m)){
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      }
      while (1){
      if (m == 1 || m == 2 || m == 0){
      return m;
      break;
      }
      else{
      cout << "抱歉!输入错误,请重新输入:";
      c = Check(1);
      return c;
      break;
      }
      }
      }
      }
      else if (a == 2) //针对字符和字符串以及特定的数字(1、2)
      {
      float m;
      float c;
      if (cin >> m)
      {
      while (1)
      {
      if (m == 1 || m == 2)
      {
      return m;
      break;
      }
      else
      {
      cout << "输入错误,请重新输入:";
      c = Check(2);
      return c;
      break;
      }
      }
      }
      else
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync();//清理缓冲区内容
      cin.get();
      while (!(cin >> m))
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      }
      while (1)
      {
      if (m == 1 || m == 2)
      {
      return m;
      break;
      }
      else
      {
      cout << "输入错误,请重新输入:";
      a = Check(2);
      return a;
      break;
      }
      }
      }
      }
      else if (a == 3) //针对字符和字符串以及特定的数字(1、2、3)
      {
      float m;
      float c;
      if (cin >> m)
      {
      while (1)
      {
      if (m == 1 || m == 2 || m == 3)
      {
      return m;
      break;
      }
      else
      {
      cout << "输入错误,请重新输入:";
      c = Check(3);
      return c;
      break;
      }
      }
      }
      else
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      while (!(cin >> m))
      {
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      }
      while (1){
      if (m == 1 || m == 2 || m == 3){
      return m;
      break;
      }
      else{
      cout << "输入错误,请重新输入:";
      a = Check(3);
      return a;
      break;
      }
      }
      }
      }
      else if (a == 4) { //针对字符和字符串以及特定的数字(1、0)
      float m;
      float c;
      if (cin >> m){
      while (1){
      if (m == 1 || m == 0){
      return m;
      break;
      }
      else{
      cout << "输入错误,请重新输入:";
      c = Check(4);
      return c;
      break;
      }
      }
      }
      else{
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      while (!(cin >> m)){
      cout << "输入错误,请重新输入:";
      cin.clear(); //清除这个错误状态
      cin.sync(); //清理缓冲区内容
      cin.get();
      }
      while (1){
      if (m == 1 || m == 0){
      return m;
      break;
      }
      else
      {
      cout << "输入错误,请重新输入:";
      a = Check(4);
      return a;
      break;
      }
      }
      }
      }
      }
      void Progress(){
      int c = 1, d = 0;
      for (int i = 0; i < 50; i++)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t+-------------------------------------------------+" << endl;
      cout << "\t\t\t\t|";
      for (int a = 0; a < i; a++) //打印▋
      {
      cout << "▋";
      }
      for (int b = 49 - i; b > 0; b--) //打印空格
      {
      cout << " ";
      }
      d += 2; //进度数
      cout << "| " << d << "%" << endl;
      cout << "\t\t\t\t+-------------------------------------------------+" << endl;
      cout << "\t\t\t\t 亲爱的用户!正在进入游戏世界,请稍后.";
      for (int j = 0; j < c % 6; j++)
      {
      cout << ".";
      }
      c++;
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      Sleep(150); //进度条读取速度
      if (i != 49)
      {
      system("cls"); //清屏
      }
      }
      Sleep(3000);
      system("cls");
      }
      int NormalizeName(char name[1000], int n)
      {
      int a = 0; //计数器
      if (n <= 15)
      {
      for (int i = 0; i < n; i++)
      {
      if (name[i] <= 32 || name[i] == 127) //为空格或其他特殊情况
      {
      break;
      }
      else
      {
      a++;
      }
      }
      if (a == n)
      {
      return 1;
      }
      else
      {
      return 0;
      }
      }
      else
      {
      return 0;
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 用户名查重系统
      int CheckName(char name[1000])
      {
      int a = 0; //计数器
      if (x == 0) //第一个注册的人无重复
      {
      return 1;
      }
      else
      {
      for (int i = 0; i < x; i++)
      {
      if (strcmp(name, peo[i].user) == 0)
      {
      break;
      }
      else
      {
      a++;
      }
      }
      if (a == x) //用户名无重复
      {
      return 1;
      }
      else
      {
      return 0;
      }
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 密码规范系统
      int NormalizePassword(char password[1000], int n)
      {
      int a = 0; //计数器
      if (n >= 6 && n <= 15)
      {
      for (int i = 0; i < n; i++)
      {
      if ((password[i] >= 48 && password[i] <= 57) || (password[i] >= 65 && password[i] <= 90) || (password[i] >= 97 && password[i] <= 122)) //为字母或数字
      {
      a++;
      }
      else
      {
      break;
      }
      }
      if (a == n)
      {
      return 1;
      }
      else
      {
      return 0;
      }
      }
      else
      {
      return 0;
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 密码找回系统
      int RefoundPassword()
      {
      while (1)
      {
      char Name2[1000];
      int Key1 = 0;
      cout << "请输入用户名:";
      cin >> Name2;
      for (int i = 0; i < X; i++) //逐个人员遍历
      {
      if (strcmp(Name2, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
      {
      Key1 = 1;
      User2 = i;
      }
      }
      system("cls"); //清屏
      if (Key1 == 0) //钥匙解锁失败
      {
      cout << "抱歉,您的用户名未注册或输入错误!!!" << endl << endl;
      cout << "1.继续找回密码" << endl;
      cout << "2.退出系统" << endl;
      cout << "请输入数字实现对应功能:";
      int m2 = Check(2); //只返回1、2
      cout << endl;
      if (m2 == 1)
      {
      system("cls"); //清屏
      continue;
      }
      else if (m2 == 2)
      {
      system("cls"); //清屏
      return 0;
      }
      }
      else if (Key1 == 1) //钥匙解锁成功
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您的密码为:" << peo[User2].password << endl;
      Sleep(2000);
      system("pause");
      system("cls"); //清屏
      return 1;
      }
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 账号注册系统:
      int Register()
      {
      int key1 = 0; //注册成功的钥匙
      int key2 = 0; //用户名设置成功的钥匙
      int key3 = 0; //密码设置成功钥匙
      int key4 = 0; //退出程序的钥匙
      int h = 0; //轮转片
      char recheck[100];
      peo[x].number = x + 1; //标号
      while (1) //创建用户名
      {
      cout << "请设置用户名(不超过15个字符,空格与汉字为非法字符):";
      cin.get(); //cin.getline前要吸收回车键
      cin.getline(peo[x].user, 1000);
      int n1 = strlen(peo[x].user);
      int p1 = NormalizeName(peo[x].user, n1); //返回1用户名通过,返回0则不通过
      int p2 = CheckName(peo[x].user); //返回1用户名通过,返回0则不通过
      if (p1 == 1 && p2 == 1)
      {
      key2 = 1; //钥匙开锁,用户名设置成功
      break;
      }
      else
      {
      cout << endl << endl;
      cout << "用户名重复或非法!!!" << endl;
      cout << "1.重新设置用户名" << endl;
      cout << "2.退出注册" << endl;
      cout << "请输入数字实现对应功能:";
      int q = Check(2); //只返回1、2
      cout << endl;
      if (q == 1) //重新设置用户名
      {
      strcpy(peo[x].user, Void); //清空输入的用户名
      system("cls"); //清屏
      continue;
      }
      else if (q == 2) //退出注册
      {
      system("cls"); //清屏
      break;
      }
      }
      }
      cout << endl << endl;
      if (key2 == 1)
      {
      while (1) //设置密码
      {
      system("cls"); //清屏
      cout << "请设置密码(只能为字母和数字,长度不小于6,不超过15):";
      if (h != 0)
      {
      cin.get(); //cin.getline前要吸收回车键
      }
      cin.getline(peo[x].password, 1000);
      //cout << peo[x].password << endl;
      int n2 = strlen(peo[x].password);
      int p3 = NormalizePassword(peo[x].password, n2); //返回1密码通过,返回0则不通过
      if (p3 == 1)
      {
      key3 = 1; //钥匙开锁,密码设置成功
      }
      else
      {
      cout << endl << endl;
      cout << "密码非法!!!" << endl;
      cout << "1.重新设置密码" << endl;
      cout << "2.退出注册" << endl;
      cout << "请输入数字实现对应功能:";
      int q = Check(2); //只返回1、2
      cout << endl;
      if (q == 1) //重新设置密码
      {
      strcpy(peo[x].password, Void); //清空输入的密码
      cout << endl << endl;
      h++;
      continue;
      }
      else if (q == 2) //退出注册
      {
      system("cls"); //清屏
      break;
      }
      }
      if (key3 == 1)
      {
      system("cls"); //清屏
      while (1)
      {
      cout << "请再次输入密码:";
      cin >> recheck;
      //cout << recheck << endl;
      if (strcmp(recheck, peo[x].password) == 0)
      {
      cout << endl;
      cout << "你真是太棒了!注册成功!!!" << endl << endl;
      (X)++;
      key1 = 1; //钥匙开锁,注册成功
      key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
      break;
      }
      else
      {
      cout << endl;
      cout << "抱歉!两次密码不一致!!!" << endl;
      cout << "1.重新设置密码" << endl;
      cout << "2.退出注册" << endl;
      cout << "请输入数字实现对应功能:";
      int z = Check(2); //只返回1、2
      cout << endl;
      if (z == 1)
      {
      strcpy(recheck, Void); //清空输入的密码
      strcpy(peo[x].password, Void); //清空输入的密码
      key3 = 0; //关锁
      h++;
      break;
      }
      else if (z == 2)
      {
      system("cls"); //清屏
      key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
      break;
      }
      }
      }
      }
      if (key4 == 1)
      {
      break;
      }
      }
      }
      if (key1 == 1)
      {
      cout << "是否直接进入程序?" << endl;
      cout << "1.是" << endl;
      cout << "2.否" << endl;
      cout << "请输入数字实现对应功能:";
      int m = Check(2); //只返回1、2
      cout << endl;
      if (m == 1)
      {
      User = x - 1;
      return m;
      }
      else if (m == 2)
      {
      return m;
      }
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 账号登录系统
      int SignIn()
      {
      char Name[1000], Password[1000];
      int Key1 = 0; //判断用户名正误的钥匙
      int Key2 = 0; //判断密码正误的钥匙
      while (1)
      {
      cout << "请输入用户名:"; //有BUG
      cin >> Name;
      for (int i = 0; i < X; i++) //逐个人员遍历
      {
      if (strcmp(Name, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
      {
      Key1 = 1;
      User = i;
      }
      }
      if (Key1 == 0) //钥匙解锁失败
      {
      cout << "这可能是个bug!抱歉!您的用户名未注册或输入错误!!!" << endl << endl;
      cout << "1.继续登录" << endl;
      cout << "2.退出登录" << endl;
      cout << "请输入数字实现对应功能:";
      int m1 = Check(2); //只返回1、2
      cout << endl;
      if (m1 == 1)
      {
      system("cls"); //清屏
      continue;
      }
      else if (m1 == 2)
      {
      system("cls"); //清屏
      return 0;
      }
      }
      else if (Key1 == 1) //钥匙解锁成功
      {
      cout << "请输入密码:";
      cin >> Password;
      if (strcmp(Password, peo[User].password) == 0) //判断输入的密码是否正确
      {
      Key2 = 1; //钥匙开锁,成功登陆
      }
      if (Key2 == 0) //密码错误
      {
      cout << endl << "您输入的密码有误" << endl;
      cout << "1.重新登录" << endl;
      cout << "2.找回密码" << endl;
      cout << "3.退出登录" << endl;
      cout << "请输入数字实现对应功能:";
      int m2 = Check(3); //只返回1、2、3
      cout << endl;
      if (m2 == 1)
      {
      Key1 = 0; //重新登陆关锁
      system("cls"); //清屏
      continue;
      }
      else if (m2 == 2)
      {
      Key1 = 0; //重新登陆关锁
      system("cls"); //清屏
      int r = RefoundPassword();
      if (r == 1)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 密码找回成功!!!" << endl;
      Sleep(2000);
      system("cls"); //清屏
      continue;
      }
      else if (r == 0)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 密码找回失败!!!" << endl;
      Sleep(2000);
      system("cls"); //清屏
      continue;
      }
      }
      else if (m2 == 3)
      {
      system("cls"); //清屏
      return 0;
      }
      }
      else if (Key2 == 1) //密码正确
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 你真是太棒了!登录成功!!!" << endl;
      Sleep(2000); //延时2秒
      return 1;
      }
      }
      }
      }
      //--------------------------------------------------------------------------------------------------------------
      // 游戏部分
      //1.雷霆战机
      /=============== all the structures ===============*/
      
      typedef struct Frame
      {
      COORD position[2];
      int flag;
      }Frame;
      
      /=============== all the functions ===============/
      
      void SetPos(COORD a)// set cursor
      {
      HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleCursorPosition(out, a);
      }
      
      void SetPos(int i, int j)// set cursor
      {
      COORD pos = { i, j };
      SetPos(pos);
      }
      
      //把第y行,[x1, x2) 之间的坐标填充为 ch
      void drawRow(int y, int x1, int x2, char ch)
      {
      SetPos(x1, y);
      for (int i = 0; i <= (x2 - x1); i++)
      cout << ch;
      }
      
      //在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
      void drawRow(COORD a, COORD b, char ch)
      {
      if (a.Y == b.Y)
      drawRow(a.Y, a.X, b.X, ch);
      else
      {
      SetPos(0, 25);
      cout << "error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
      system("pause");
      }
      }
      
      //把第x列,[y1, y2] 之间的坐标填充为 ch
      void drawCol(int x, int y1, int y2, char ch)
      {
      int y = y1;
      while (y != y2 + 1)
      {
      SetPos(x, y);
      cout << ch;
      y++;
      }
      }
      
      //在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
      void drawCol(COORD a, COORD b, char ch)
      {
      if (a.X == b.X)
      drawCol(a.X, a.Y, b.Y, ch);
      else
      {
      SetPos(0, 25);
      cout << "error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
      system("pause");
      }
      }
      
      //左上角坐标、右下角坐标、用row填充行、用col填充列
      void drawFrame(COORD a, COORD b, char row, char col)
      {
      drawRow(a.Y, a.X + 1, b.X - 1, row);
      drawRow(b.Y, a.X + 1, b.X - 1, row);
      drawCol(a.X, a.Y + 1, b.Y - 1, col);
      drawCol(b.X, a.Y + 1, b.Y - 1, col);
      }
      
      void drawFrame(int x1, int y1, int x2, int y2, char row, char col)
      {
      COORD a = { x1, y1 };
      COORD b = { x2, y2 };
      drawFrame(a, b, row, col);
      }
      
      void drawFrame(Frame frame, char row, char col)
      {
      COORD a = frame.position[0];
      COORD b = frame.position[1];
      drawFrame(a, b, row, col);
      }
      
      void drawPlaying()
      {
      drawFrame(0, 0, 48, 24, '=', '|');// draw Map frame;
      drawFrame(49, 0, 79, 4, '-', '|');// draw output frame
      drawFrame(49, 4, 79, 9, '-', '|');// draw score frame
      drawFrame(49, 9, 79, 20, '-', '|');// draw operate frame
      drawFrame(49, 20, 79, 24, '-', '|');// draw other message frame
      SetPos(52, 6);
      cout << "得分:";
      SetPos(52, 7);
      cout << "称号:";
      SetPos(52, 10);
      cout << "操作方式:";
      SetPos(52, 12);
      cout << " a,s,d,w 控制移动,j开炮";
      SetPos(52, 14);
      cout << " p 暂停游戏";
      SetPos(52, 16);
      cout << " e 退出游戏";
      }
      
      //在[a, b)之间产生一个随机整数
      int random(int a, int b)
      {
      int c = (rand() % (a - b)) + a;
      return c;
      }
      
      //在两个坐标包括的矩形框内随机产生一个坐标
      COORD random(COORD a, COORD b)
      {
      int x = random(a.X, b.X);
      int y = random(a.Y, b.Y);
      COORD c = { x, y };
      return c;
      }
      
      bool judgeCoordInFrame(Frame frame, COORD spot)
      {
      if (spot.X >= frame.position[0].X)
      if (spot.X <= frame.position[1].X)
      if (spot.Y >= frame.position[0].Y)
      if (spot.Y <= frame.position[0].Y)
      return true;
      return false;
      }
      
      void printCoord(COORD a)
      {
      cout << "( " << a.X << " , " << a.Y << " )";
      }
      
      void printFrameCoord(Frame a)
      {
      printCoord(a.position[0]);
      cout << " - ";
      printCoord(a.position[1]);
      }
      
      int drawMenu()
      {
      SetPos(30, 1);
      cout << "P l a n e W a r";
      drawRow(3, 0, 79, '-');
      drawRow(5, 0, 79, '-');
      SetPos(28, 4);
      cout << "w 和 s 选择, j 确定";
      SetPos(15, 11);
      cout << "1. 简单的敌人";
      SetPos(15, 13);
      cout << "2. 冷酷的敌人";
      drawRow(20, 0, 79, '-');
      drawRow(22, 0, 79, '-');
      SetPos(47, 11);
      cout << "简单的敌人:";
      SetPos(51, 13);
      cout << "简单敌人有着较慢的移动速度。";
      SetPos(24, 21);
      cout << "说明:得分超过200即为胜利";
      int j = 11;
      SetPos(12, j);
      cout << ">>";
      while (1)
      {
      if (_kbhit())
      {
      char x = _getch();
      switch (x)
      {
      case 'w':
      {
      if (j == 13)
      {
      SetPos(12, j);
      cout << " ";
      j = 11;
      SetPos(12, j);
      cout << ">>";
      SetPos(51, 13);
      cout << "            ";
      SetPos(47, 11);
      cout << "简单的敌人:";
      SetPos(51, 13);
      cout << "简单敌人有较慢的移动速度,比较容易对付";
      }
      break;
      }
      case 's':
      {
      if (j == 11)
      {
      SetPos(12, j);
      cout << " ";
      j = 13;
      SetPos(12, j);
      cout << ">>";
      SetPos(51, 13);
      cout << "              ";
      SetPos(47, 11);
      cout << "冷酷的敌人:";
      SetPos(51, 13);
      cout << "冷酷的敌人移动速度较快,不是很好对付哟。";
      }
      break;
      }
      case 'j':
      {
      if (j == 8) return 1;
      else return 2;
      }
      }
      }
      }
      }
      /================== the Game Class ==================/
      
      class Game
      {
      public:
      COORD position[10];
      COORD bullet[10];
      Frame enemy[8];
      int rank;
      int rankf;
      string title;
      int flag_rank;
      
      Game();
      
      //初始化所有
      void initPlane();
      void initBullet();
      void initEnemy();
      
      //初始化其中一个
      //void initThisBullet( COORD );
      //void initThisEnemy( Frame );
      
      void planeMove(char);
      void bulletMove();
      void enemyMove();
      void drawPlane();
      void drawPlaneToNull();
      void drawBullet();
      void drawBulletToNull();
      void drawEnemy();
      void drawEnemyToNull();
      void drawThisBulletToNull(COORD);
      void drawThisEnemyToNull(Frame);
      void Pause();
      void Playing();
      int judgePlane();
      void judgeEnemy();
      void Shoot();
      void GameOver();
      void printScore();
      };
      Game::Game()
      {
      initPlane();
      initBullet();
      initEnemy();
      score = 0;
      rank = 25;
      rankf = 0;
      flag_rank = 0;
      }
      void Game::initPlane()
      {
      COORD centren = { 39, 22 };
      position[0].X = position[5].X = position[7].X = position[9].X = centren.X;
      position[1].X = centren.X - 2;
      position[2].X = position[6].X = centren.X - 1;
      position[3].X = position[8].X = centren.X + 1;
      position[4].X = centren.X + 2;
      for (int i = 0; i <= 4; i++)
      position[i].Y = centren.Y;
      for (int i = 6; i <= 8; i++)
      position[i].Y = centren.Y + 1;
      position[5].Y = centren.Y - 1;
      position[9].Y = centren.Y - 2;
      }
      void Game::drawPlane()
      {
      for (int i = 0; i < 9; i++)
      {
      SetPos(position[i]);
      if (i != 5)
      cout << "O";
      else if (i == 5)
      cout << "|";
      }
      }
      void Game::drawPlaneToNull()
      {
      for (int i = 0; i < 9; i++)
      {
      SetPos(position[i]);
      cout << " ";
      }
      }
      void Game::initBullet()
      {
      for (int i = 0; i < 10; i++)
      bullet[i].Y = 30;
      }
      void Game::drawBullet()
      {
      for (int i = 0; i < 10; i++)
      {
      if (bullet[i].Y != 30)
      {
      SetPos(bullet[i]);
      cout << "^";
      }
      }
      }
      void Game::drawBulletToNull()
      {
      for (int i = 0; i < 10; i++)
      if (bullet[i].Y != 30)
      {
      COORD pos = { bullet[i].X, bullet[i].Y + 1 };
      SetPos(pos);
      cout << " ";
      }
      }
      void Game::initEnemy()
      {
      COORD a = { 1, 1 };
      COORD b = { 45, 15 };
      for (int i = 0; i < 8; i++)
      {
      enemy[i].position[0] = random(a, b);
      enemy[i].position[1].X = enemy[i].position[0].X + 3;
      enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
      }
      }
      void Game::drawEnemy()
      {
      for (int i = 0; i < 8; i++)
      drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
      }
      
      void Game::drawEnemyToNull()
      {
      for (int i = 0; i < 8; i++)
      {
      drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
      }
      }
      void Game::Pause()
      {
      SetPos(61, 2);
      cout << " ";
      SetPos(61, 2);
      cout << "暂停中...";
      char c = _getch();
      while (c != 'p')
      c = _getch();
      SetPos(61, 2);
      cout << " ";
      }
      void Game::planeMove(char x)
      {
      if (x == 'a')
      if (position[1].X != 1)
      for (int i = 0; i <= 9; i++)
      position[i].X -= 2;
      
      if (x == 's')
      if (position[7].Y != 23)
      for (int i = 0; i <= 9; i++)
      position[i].Y += 1;
      
      if (x == 'd')
      if (position[4].X != 47)
      for (int i = 0; i <= 9; i++)
      position[i].X += 2;
      
      if (x == 'w')
      if (position[5].Y != 3)
      for (int i = 0; i <= 9; i++)
      position[i].Y -= 1;
      }
      void Game::bulletMove()
      {
      for (int i = 0; i < 10; i++)
      {
      if (bullet[i].Y != 30)
      {
      bullet[i].Y -= 1;
      if (bullet[i].Y == 1)
      {
      COORD pos = { bullet[i].X, bullet[i].Y + 1 };
      drawThisBulletToNull(pos);
      bullet[i].Y = 30;
      }
      
      }
      }
      }
      void Game::enemyMove()
      {
      for (int i = 0; i < 8; i++)
      {
      for (int j = 0; j < 2; j++)
      enemy[i].position[j].Y++;
      
      if (24 == enemy[i].position[1].Y)
      {
      COORD a = { 1, 1 };
      COORD b = { 45, 3 };
      enemy[i].position[0] = random(a, b);
      enemy[i].position[1].X = enemy[i].position[0].X + 3;
      enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
      }
      }
      }
      int Game::judgePlane()
      {
      for (int i = 0; i < 8; i++)
      {
      for (int j = 0; j < 9; j++)
      {
      if (judgeCoordInFrame(enemy[i], position[j]))
      {
      SetPos(62, 1);
      cout << "坠毁";
      drawFrame(enemy[i], '+', '+');
      Sleep(1000);
      GameOver();
      return 1;
      }
      }
      }
      }
      void Game::drawThisBulletToNull(COORD c)
      {
      SetPos(c);
      cout << " ";
      }
      void Game::drawThisEnemyToNull(Frame f)
      {
      drawFrame(f, ' ', ' ');
      }
      void Game::judgeEnemy()
      {
      for (int i = 0; i < 8; i++)
      for (int j = 0; j < 10; j++)
      if (judgeCoordInFrame(enemy[i], bullet[j]))
      {
      score += 5;
      drawThisEnemyToNull(enemy[i]);
      COORD a = { 1, 1 };
      COORD b = { 45, 3 };
      enemy[i].position[0] = random(a, b);
      enemy[i].position[1].X = enemy[i].position[0].X + 3;
      enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
      drawThisBulletToNull(bullet[j]);
      bullet[j].Y = 30;
      }
      }
      void Game::Shoot()
      {
      for (int i = 0; i < 10; i++)
      if (bullet[i].Y == 30)
      {
      bullet[i].X = position[5].X;
      bullet[i].Y = position[5].Y - 1;
      break;
      }
      }
      void Game::printScore()
      {
      if (score == 30 && flag_rank == 0)
      {
      rank -= 3;
      flag_rank = 1;
      }
      
      else if (score == 70 && flag_rank == 1)
      {
      rank -= 5;
      flag_rank = 2;
      }
      else if (score == 110 && flag_rank == 2)
      {
      rank -= 5;
      flag_rank = 3;
      }
      int x = rank / 5;
      SetPos(60, 6);
      cout << score;
      
      if (rank != rankf)
      {
      SetPos(60, 7);
      if (x == 5)
      title = "初级飞行员";
      else if (x == 4)
      title = "中级飞行员";
      else if (x == 3)
      title = "高级飞行员";
      else if (x == 2)
      title = "王牌飞行员";
      cout << title;
      }
      rankf = rank;
      }
      
      void Game::Playing(){
      drawEnemy();
      drawPlane();
      int flag_bullet = 0;
      int flag_enemy = 0;
      while (1)
      {
      Sleep(8);
      if (_kbhit()){
      char x = _getch();
      if ('a' == x || 's' == x || 'd' == x || 'w' == x){
      drawPlaneToNull();
      planeMove(x);
      drawPlane();
      int ggg = judgePlane();
      if (ggg == 1) return;
      }
      else if ('p' == x) //暂停
      Pause();
      else if ('j' == x) //开炮
      Shoot();
      else if ('e' == x)
      {
      break;
      }
      
      }
      if (0 == flag_bullet)
      {
      bulletMove();
      drawBulletToNull();
      drawBullet();
      judgeEnemy();
      }
      flag_bullet++;
      if (5 == flag_bullet)
      flag_bullet = 0;
      if (0 == flag_enemy)
      {
      drawEnemyToNull();
      enemyMove();
      drawEnemy();
      int gggg = judgePlane();
      if (gggg == 1)
      {
      return;
      }
      }
      flag_enemy++;
      if (flag_enemy >= rank)
      flag_enemy = 0;
      printScore();
      }
      return;
      }
      void Game::GameOver()
      {
      system("cls");
      COORD p1 = { 28,9 };
      COORD p2 = { 53,15 };
      drawFrame(p1, p2, '=', '|');
      SetPos(36, 12);
      string str = "Game Over!";
      for (int i = 0; i < str.size(); i++)
      {
      Sleep(80);
      cout << str[i];
      }
      Sleep(1000);
      system("cls");
      drawFrame(p1, p2, '=', '|');
      SetPos(31, 11);
      cout << "击落敌机:" << score / 5 << " 架";
      SetPos(31, 12);
      cout << "得  分:" << score;
      SetPos(31, 13);
      cout << "获得称号:" << title;
      Sleep(3000);
      return;
      }
      void PlaneWar()
      {
      cout << "*********************************************** 雷 霆 战 机 *************************************************" << endl;
      cout << " 游戏说明:" << endl;
      cout << " ① 玩家通过按键w、s、a、d进行战机的移动,a为向左移动,s为向下移动,d为向右移动,w为向上移动,通过按键j进行开炮操作;" << endl;
      cout << " ② 玩家需要躲避敌方战机,若有碰撞,则您的战机坠毁,游戏结束;" << endl;
      cout << " ③ 玩家通过开炮可击落敌方战机,每击落一架战机,可获得5分;" << endl;
      cout << " ④ 游戏得分超过200分即为游戏胜利,将获得30枚硬币的奖励,否则即为失败。" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      system("cls");
      srand((int)time(0)); //随机种子
      Game game;
      int a = drawMenu();
      if (a == 2)
      game.rank = 20;
      system("cls");
      drawPlaying();
      game.Playing(); //开始游戏
      Q1 = &score;
      return;
      }
      void color(int a)//颜色函数
      {
      SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), a);
      }
      void gotoxy(int x, int y)//位置函数(行为x 列为y)
      {
      COORD pos;
      pos.X = 2 * y;
      pos.Y = x;
      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
      }
      void begin() {
      system("cls");
      color(11); cout << " ★";
      color(10); cout << "吃豆人";
      color(11); cout << "★\n\n";
      color(7);
      cout << " 请将窗口开至";
      color(11); cout << "全屏" << endl;
      color(7); cout << " 正在初始化,请耐心等待";
      for (int i = 0; i <= nn; i++)
      for (int j = 1; j <= nn; j++)
      dis[i][j] = 900;
      for (int i = 0; i <= nn; i++) {
      for (int j = 0; j <= 3; j++) {
      if (i + fx[j] >= 0 && i + fx[j] <= nn) {
      int k = i + fx[j], xx = k / 27, yy = k % 27, kk;
      if (changdi[i / 27][i % 27] && changdi[xx][yy]) dis[i][k] = kk = 1;
      }
      }
      }
      for (int k = 0; k <= nn; k++)if (changdi[k]) {
      for (int i = 0; i <= nn; i++)if (changdi[i])
      for (int j = 0; j <= nn; j++)if (changdi[j])
      if (dis[i][j] > dis[i][k] + dis[k][j])
      dis[i][j] = dis[i][k] + dis[k][j];
      if (k % 80 == 0) { color(13); gotoxy(3, 12); cout << "│"; }
      if (k % 80 == 20) { color(13); gotoxy(3, 12); cout << "╱"; }
      if (k % 80 == 40) { color(13); gotoxy(3, 12); cout << "─"; }
      if (k % 80 == 60) { color(13); gotoxy(3, 12); cout << "╲"; }
      if (k % 60 == 0) { color(11); gotoxy(5, k / 60); cout << "●"; }
      }
      
      cout << "游戏操作如下:";
      }
      
      void shuru() {
      char ch;
      cout << "请在输入完成后点击回车";
      cin >> ch;
      if ((ch == '1') | (ch == 'j'))
      if ((changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 1) | (changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 2)) fangx = nextfx = 0;
      else nextfx = 0;
      else if ((ch == '2') | (ch == 'k'))
      if ((changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 1) | (changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 2)) fangx = nextfx = 1;
      else nextfx = 1;
      else if ((ch == '3') | (ch == 'l'))
      if ((changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 1) | (changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 2)) fangx = nextfx = 2;
      else nextfx = 2;
      else if ((ch == '5') | (ch == 'i'))
      if ((changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 1) | (changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 2)) fangx = nextfx = 3;
      else nextfx = 3;
      else if ((ch == '0') | (ch == 's')) stopped = (stopped + 1) % 2;
      else if ((ch == '4') | (ch == 'a')) t1++;
      else if ((ch == '7') | (ch == 'q')) t2++;
      else if (((ch == '6') | (ch == 'd')) && t1 - 1 > 0) t1--;
      else if (((ch == '9') | (ch == 'e')) && t2 - 1 > 0) t2--;
      else if (ch == 'g') dali = (dali + 1) % 2;
      }
      
      void reset() {
      system("cls"); color(7);
      gotoxy(2, 30); cout << "控制方向:I/J/K/L";
      gotoxy(4, 30); cout << "你的速度:4/6";
      gotoxy(6, 30); cout << "怪物速度:7/9";
      xx = 22; yy = 13;
      xx1 = xx2 = xx3 = xx4 = 14;
      yy5 = 11; yy2 = 12; yy3 = 14; yy4 = 15;
      now = 607; now1 = 389; now2 = 390; now3 = 392; now4 = 393;
      for (int k = 0; k <= nn; k++) {
      int i = k / 27, j = k % 27;
      gotoxy(i, j);
      if (changdi[i][j] == 1) { color(7); cout << "·"; }
      else if (!changdi[i][j]) { color(1); cout << "■"; }
      if (j == 26) { gotoxy(i, 27); color(7); cout << i; }
      }
      gotoxy(0, 0);
      gotoxy(xx, yy); color(14); cout << "●";
      gotoxy(xx1, yy5); color(4); cout << "◆";
      gotoxy(xx2, yy2); color(5); cout << "◆";
      gotoxy(xx3, yy3); color(3); cout << "◆";
      gotoxy(xx4, yy4); color(2); cout << "◆";
      fangx = 0; T1 = T2 = guaitimer = 0; t1 = 75; t2 = 100;
      stopped = 0; fenshu = 0; guozi = 237;
      gg1 = gg2 = gg3 = gg4 = 0; dali = 0;
      gotoxy(14, 30);
      cout << " ";
      }
      
      void move1() {
      int xxx, yyy;
      xxx = xx + fxfx[nextfx][0]; yyy = yy + fxfx[nextfx][1];
      if (changdi[xxx][yyy]) {
      if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
      color(14);
      gotoxy(xx, yy); printf(" ");
      gotoxy(xxx, yyy); if (!dali) printf("◎"); else printf("☆");
      now = xx * 27 + yy; xx = xxx; yy = yyy;
      fangx = nextfx;
      }
      else {
      if (xx == 13 && yy == 0 && fangx == 0) { xxx = xx; yyy = 26; }
      else if (xx == 13 && yy == 26 && fangx == 2) { xxx = xx; yyy = 0; }
      else { xxx = xx + fxfx[fangx][0]; yyy = yy + fxfx[fangx][1]; }
      if (changdi[xxx][yyy]) {
      if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
      color(14);
      gotoxy(xx, yy); cout << " ";
      gotoxy(xxx, yyy);
      if (!dali) cout << "◎";
      else cout << "☆";
      now = xx * 27 + yy; xx = xxx; yy = yyy;
      }
      }
      color(7);
      }
      
      void move2() {
      int haha, minhaha, xxx, yyy, chi = 0;
      if (gg1) {
      minhaha = 2147483647;
      if ((now1 % 27 == 0) | (now1 % 27 == 26)) haha = last1;
      else if (!dali) {
      for (int i = 0; i <= 3; i++)
      if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha > dis[now1 + fx[i]][now])
      {
      minhaha = dis[now1 + fx[i]][now]; haha = i;
      }
      }
      else {
      minhaha = -minhaha;
      for (int i = 0; i <= 3; i++)
      if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha < dis[now1 + fx[i]][now])
      {
      minhaha = dis[now1 + fx[i]][now]; haha = i;
      }
      }
      xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
      if (changdi[xxx][yyy] == 1) cout << "·";
      else cout << " ";
      now1 += fx[haha]; last1 = (haha + 2) % 4;
      xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
      color(4); cout << "◆";
      color(7);
      if (xxx == xx && yyy == yy) {
      if (!dali) chi += 1;
      else {
      guozi += 50;
      fenshu += 50;
      last1 = 0;
      gotoxy(now1 / 27, now1 % 27);
      if (changdi[now1 / 27][now1 % 27] == 1) printf("·"); else printf(" ");
      now1 = 389;
      }
      }
      }
      if (gg2) {
      int k;
      minhaha = 2147483647;
      if ((fangx == 0) | (fangx == 2)) {
      k = yy + (fxfx[fangx][1]) * 3;
      while ((k > 25) | !changdi[xx][k]) k--;
      while ((k < 1) | !changdi[xx][k]) k++;
      }
      else {
      k = xx + (fxfx[fangx][0]) * 3;
      while ((k > 28) | !changdi[k][yy]) k--;
      while ((k < 1) | !changdi[k][yy]) k++;
      }
      if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
      
      if ((now2 % 27 == 0) | (now2 % 27 == 26)) haha = last2;
      else if (!dali)
      for (int i = 0; i <= 3; i++) {
      if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha > dis[now2 + fx[i]][k])
      {
      minhaha = dis[now2 + fx[i]][k]; haha = i;
      }
      }
      else {
      minhaha = -minhaha;
      for (int i = 0; i <= 3; i++) {
      if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha < dis[now2 + fx[i]][k])
      {
      minhaha = dis[now2 + fx[i]][k]; haha = i;
      }
      }
      }
      
      xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy);
      if (changdi[xxx][yyy] == 1) cout << "·";
      else cout << " ";
      now2 += fx[haha]; last2 = (haha + 2) % 4; gotoxy(18, 30);
      xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy); color(5); cout << "◆";
      color(7);
      if (xxx == xx && yyy == yy) {
      if (!dali) chi += 1;
      else {
      guozi += 50;
      fenshu += 50;
      last2 = 0;
      gotoxy(now2 / 27, now2 % 27);
      if (changdi[now2 / 27][now2 % 27] == 1) cout << "·"; else cout << " ";
      now2 = 390;
      }
      }
      }
      if (gg3) {
      int k;
      minhaha = 2147483647;
      if ((fangx == 0) | (fangx == 2)) {
      k = yy + (fxfx[(fangx + 1) % 4][1]) * 3;
      while ((k > 25) | !changdi[xx][k]) k--;
      while ((k < 1) | !changdi[xx][k]) k++;
      }
      else {
      k = xx + (fxfx[(fangx + 1) % 4][0]) * 3;
      while ((k > 28) | !changdi[k][yy]) k--;
      while ((k < 1) | !changdi[k][yy]) k++;
      }
      if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
      
      if ((now3 % 27 == 0) | (now3 % 27 == 26)) haha = last3;
      else if (!dali)
      for (int i = 0; i <= 3; i++) {
      if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha > dis[now3 + fx[i]][k])
      {
      minhaha = dis[now3 + fx[i]][k]; haha = i;
      }
      }
      else {
      minhaha = -minhaha;
      for (int i = 0; i <= 3; i++) {
      if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha < dis[now3 + fx[i]][k])
      {
      minhaha = dis[now3 + fx[i]][k]; haha = i;
      }
      }
      }
      
      xxx = now3 / 27; yyy = now3 % 27; gotoxy(xxx, yyy);
      if (changdi[xxx][yyy] == 1) cout << "·"; else cout << " ";
      now3 += fx[haha]; last3 = (haha + 2) % 4; gotoxy(18, 30);
      xxx = now3 / 27; yyy = now3 % 27;
      gotoxy(xxx, yyy); color(3); cout << "◆";
      color(7);
      if (xxx == xx && yyy == yy) {
      if (!dali) chi += 1;
      else {
      guozi += 50;
      fenshu += 50;
      last3 = 0;
      gotoxy(now3 / 27, now3 % 27);
      if (changdi[now3 / 27][now3 % 27] == 1) printf("·"); else printf(" ");
      now3 = 341;
      }
      }
      }
      if (chi) beichi++;
      }
      void ChiDouRen()
      {
      Q2 = &beichi;
      system("color 07"); //设置背景色为黑色,字体颜色为黑色
      cout << "*********************************************** 吃 豆 人 **************************************************" << endl;
      cout << " 游戏说明:" << endl;
      cout << " ① 玩家通过按键I、J、K、L配合回车键进行移动,J为向左移动,K为向下移动,L为向右移动,I为向上移动;" << endl;
      cout << " ② 游戏胜利条件为不被怪物吃掉并且吃满35个豆子;" << endl;
      cout << " ③ 被怪物吃掉后游戏不会终止,但是将失去游戏奖励,判定为游戏失败。" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      system("cls");
      begin();
      int jixu = 1;
      reset();
      string bb[4] = { "●","①","②","③" }; color(7);
      gotoxy(12, 12); cout << "进入倒计时开始!";
      color(12);
      for (int i = 3; i >= 0; i--) { if (i == 0) color(11); gotoxy(13, 13); cout << bb[i]; Sleep(1000); }
      gotoxy(12, 12); cout << " ";
      gotoxy(13, 13); cout << " ";
      color(7);
      while (!ff) {
      Sleep(1);
      gotoxy(10, 30); cout << "你最后的得分是:" << fenshu;//gotoxy(行,列)坐标
      gotoxy(8, 30); cout << "怪物速度: " << 300 - t2;
      gotoxy(9, 30); cout << "你的速度: " << 300 - t1;
      gotoxy(15, 30); cout << "被吃次数:" << beichi;
      if (_kbhit()) shuru();//这个这个
      if (stopped) continue;
      T1 = (T1 + 1) % t1; T2 = (T2 + 1) % t2;
      if ((T1 % t1 == 0 && now + fx[fangx] > 0) && (now + fx[fangx] < nn)) move1();
      if (T2 % t2 == 0) {
      if (guaitimer <= 8) {
      if (guaitimer == 0) gg1 = 1;
      if (guaitimer == 8) gg2 = 1;
      guaitimer++;
      }
      if (!gg3 && fenshu >= 30) gg3 = 1;
      move2();
      }
      if (fenshu == guozi || fenshu == 35)ff = 2;
      }
      if (ff == 2) {
      Sleep(2000);
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 恭喜您吃完了35个豆子!!!" << endl;
      Sleep(2000);
      cout << "\t\t\t\t\t\t 您一共被怪物吃掉了" << beichi << " 次";
      Sleep(2000);
      }
      }
      void setdata() //数据的初始化函数
      {
      snake_x[0] = high / 2; snake_y[0] = width / 3; //初始化蛇头,在地图内的位置随意
      snake_x[1] = high / 2; snake_y[1] = width / 3 + 1; //初始化蛇身
      snake_length = 2; //蛇的原始尺寸(一格头一格身子)
      food_x = high / 3, food_y = width / 3; //初始化食物的位置,在地图内位置随意
      SCORE = 0;
      int i, j;
      Map[snake_x[0]][snake_y[0]] = 4; //蛇头
      Map[snake_x[1]][snake_y[1]] = 1; //蛇身
      Map[food_x][food_y] = 2; //食物
      for (i = 0; i < high; i++) //墙
      for (j = 0; j < width; j++)
      if (i == 0 || j == 0 || i == high - 1 || j == width - 1)
      Map[i][j] = 3;
      }
      void Gotoxy(int x, int y) //画面打印
      {
      HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
      COORD pos;
      pos.X = x;
      pos.Y = y;
      SetConsoleCursorPosition(handle, pos);
      }
      void show()
      {
      Gotoxy(0, 0);
      int i, j;
      for (i = 0; i < high; i++)
      {
      for (j = 0; j < width; j++)
      {
      if (Map[i][j] == 0)
      cout << " ";
      else if (Map[i][j] == 1)
      cout << "+";
      else if (Map[i][j] == 2)
      cout << "@";
      else if (Map[i][j] == 3)
      cout << "*";
      else if (Map[i][j] == 4)
      cout << "0";
      }
      printf("\n");
      }
      printf("得分:%d", SCORE);
      }
      
      int updatewithoutinput() //与输入无关的更新
      {
      
      int i;
      if (snake_x[0] == food_x && snake_y[0] == food_y)
      {
      SCORE++;
      srand((unsigned)time(NULL)); //srand和rand函数连用产生随机数,一般以时间作为产生随机数的种子
      food_x = rand() % (high - 3) + 1;
      food_y = rand() % (width - 3) + 1;
      Map[food_x][food_y] = 2;
      snake_length++;
      }
      if (snake_x[0] == 0 || snake_x[0] == high - 1 || snake_y[0] == 0 || snake_y[0] == width - 1) //碰墙了
      {
      cout << "游戏结束!" << endl;
      Sleep(2000);
      return 1;
      }
      for (i = 1; i < snake_length; i++) //碰到自己了 ,遍历蛇身找是否和蛇头重复
      if (snake_x[0] == snake_x[i] && snake_y[0] == snake_y[i])
      {
      cout << "游戏结束" << endl;
      Sleep(2000);
      return 1;
      }
      }
      int updatewithinput()
      {
      int i = 1;
      if (kbhit())
      input = getch();
      
      if (input != '\0') //input!='\0'(空)表示当有输入的时候开始更新画面,这是游戏开始的条件
      {
      if (input == 'w' || input == 'a' || input == 's' || input == 'd')
      {
      if (primeinput == 'w' && input == 's' || primeinput == 's' && input == 'w' || primeinput == 'a' && input == 'd' || primeinput == 'd' && input == 'a')
      {
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 世上没有回头路!!!" << endl;
      Sleep(2000);
      Death++;
      return 1;
      }
      else
      primeinput = input;
      }
      else if (primeinput == '.')
      primeinput = 'w';
      else if (input == 'p')
      {
      while (1)
      {
      char op;
      op = getch();
      if (op == 'p')
      {
      input = '.';
      break;
      }
      }
      }
      else if (input == '+')
      {
      if (op >= 50) //表示最快速度为25 ms刷新一次
      op = op / 2;
      }
      else if (input == '-')
      {
      if (op <= 1000) //表示最慢速度为 2000 ms刷新一次
      op = op * 2;
      }
      Map[snake_x[snake_length - 1]][snake_y[snake_length - 1]] = 0;//蛇走过一格,蛇尾处变为空格
      for (i = snake_length - 1; i > 0; i--)
      {
      snake_x[i] = snake_x[i - 1]; //走过一格后蛇身的坐标覆盖前面的坐标 (从后往前覆盖,蛇头也会被蛇身覆盖)
      snake_y[i] = snake_y[i - 1];
      Map[snake_x[i]][snake_y[i]] = 1;
      }
      
      }
      if (primeinput == 'w')
      snake_x[0]--;
      else if (primeinput == 's')
      snake_x[0]++;
      else if (primeinput == 'a')
      snake_y[0]--;
      else if (primeinput == 'd')
      snake_y[0]++;
      Map[snake_x[0]][snake_y[0]] = 4; //蛇头的坐标覆盖前面的坐标
      }
      void tanchishe() //起始函数
      {
      cout << "************************************************ 贪 吃 蛇 " << endl;
      cout << " 游戏说明:" << endl;
      cout << " ① 玩家通过按键w、a、s、d控制蛇的移动,w为向上移动,s为向下移动,a为向左移动,d为向右移动;" << endl;
      cout << " ② 每吃到一次果实,蛇身长度+1,得分+1;" << endl;
      cout << " ③ 撞到墙壁,即蛇死亡,来到结算界面;" << endl;
      cout << " ④ 单局得分超过15分,则为游戏胜利,可获得20枚硬币奖励!" << endl;
      cout << " 警告:请勿自噬(蛇头反向蛇身移动,撞向蛇身不算),自噬则蛇永久死亡,无法再次游玩游戏!!!" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      system("cls");
      setdata();//数据初始化
      Q3 = &SCORE;
      while (1)
      {
      show(); //画面打印
      Sleep(op);
      int a = updatewithoutinput(); //与输入无关的更新
      int b = updatewithinput(); //与输入有关的更新
      if (a == 1 || b == 1)
      {
      break;
      }
      }
      return;
      }
      void caishuzi()
      {
      cout << " 猜 数 字 " << endl;
      cout << " 游戏说明:" << endl;
      cout << " ① 游戏会出现一个1~100的随机隐藏整数,玩家需要根据技巧猜测数字;" << endl;
      cout << " ② 游戏很简单,但是如果加上猜测的次数限定呢?" << endl;
      cout << " ③ 若猜测次数不超过8次,则游戏胜利,玩家可获得20硬币的奖励,否则即为失败;" << endl;
      cout << " ④ 若玩家运气好到爆炸,一次就猜中,则视为中了彩票,将获得200硬币的奖励!!!" << endl;
      cout << " 注:若一直猜不正确,可按888退出游戏" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      system("cls"); //清屏
      Guesstimes = 0; //记录猜测次数,方便程序判定游戏是否胜利
      srand((unsigned)time(NULL)); //依据时间的变化产生不同的随机数种子
      int NUM = rand() % 100 + 1; //随机数发生器,随机生成1~100的整型数字
      while (1) //永真循环
      {
      cout << " 猜 数 字 ";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t请输入您猜测的数字(整数):";
      int Value = Check(0); //规范用户的输入,保证输入的为数字
      if (Value == 888)
      {
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您已强制退出!!!" << endl;
      Sleep(1000);
      system("cls");
      Guesstimes = 999;
      break;
      }
      if (Value > NUM)
      {
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 猜测过大!!!" << endl;
      Sleep(1000);
      system("cls");
      Guesstimes++;
      continue;
      }
      else if (Value < NUM)
      {
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 猜测过小!!!" << endl;
      Sleep(1000);
      system("cls");
      Guesstimes++;
      continue;
      }
      else if (Value == NUM)
      {
      system("cls");
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 恭喜您,猜对啦!!!" << endl;
      Sleep(2000);
      system("cls");
      Guesstimes++;
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您猜测的次数为:" << Guesstimes << endl;
      Sleep(2000);
      system("cls");
      break;
      }
      }
      return;
      }
      int LianAiCeShi()
      {
      int N, SUMS = 0;
      cout << " 恋 爱 指 数 测 试 器 *****************************************" << endl;
      cout << " 测试说明:" << endl;
      cout << " ① 您需要对接下来的问题进行如实回答,你的心越纯,测试的结果越正确;" << endl;
      cout << " ② 下列问题如果是则输入2,如果不是则输入1,一点也没感觉则输入0;" << endl;
      cout << " ③ 加油,面对你自己!-o-" << endl;
      cout << " 注:测试共包括10道题,一旦进入测试不可退出" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      system("cls");
      cout << "进入测试请按3,退出测试请按4。" << endl;
      Enter:
      cout << "请给出你的选择:";
      int choose = Check(0);
      if (choose == 3) {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 开始测试!!!" << endl;
      Sleep(2000);
      system("cls");
      }
      else if (choose == 4) {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您已退出测试!!!" << endl;
      Sleep(2000);
      system("cls");
      return 0;
      }
      else {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t无效输入,请重新选择!!!" << endl;
      Sleep(2000);
      system("cls");
      goto Enter;
      }
      cout << "question one:" << "你是否面对异性时会心跳加速?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question two:" << "你是否看到异性被欺负时会很愤怒?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question three:" << "你是否惧怕见到异性的家长?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question four:" << "你是否经常刷一位异性的社交平台?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question five:" << "想不想和Ta用情侣头像?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question six:" << "和Ta邂逅过吗?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question seven:" << "吃过同一个饭碗里的东西吗?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question eight:" << "有过在梦里与Ta相遇吗?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question nine:" << "有为了等Ta一个人站在风雨中吗?" << endl;
      N = Check(1);
      SUMS += N;
      cout << endl;
      cout << "question ten:" << "想摸Ta的头发,牵TA的手吗?" << endl;
      N = Check(1);
      SUMS += N;
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 正在测评中,请稍等......" << endl;
      Sleep(3000);
      system("cls");
      if (SUMS >= 16 && SUMS <= 20)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t你的恋爱指数为:A。你是一个深深爱着Ta的人,你往往会守着这份爱走下去-。" << endl;
      Sleep(5000);
      system("cls");
      }
      if (SUMS <= 15 && SUMS >= 12)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t你的恋爱指数为:B。你是一个矛盾却又不失爱意的人,你的爱往往一波三折!-!。" << endl;
      Sleep(5000);
      system("cls");
      }
      if (SUMS <= 11 && SUMS >= 7)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t 你的恋爱指数为:C。你是一个有点心思的人,你想表白,却又惧怕现实,你仍须努力o-o。" << endl;
      Sleep(5000);
      system("cls");
      }
      if (SUMS <= 6 && SUMS >= 0)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t你的恋爱指数为:D。你是一个无暇无垢,不食人间烟火的人,想一路踏歌,但道路上仍需佳人陪伴+-+。" << endl;
      Sleep(5000);
      system("cls");
      }
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t 人生在世,恍如昨世,孤独的身影终难走远,你的那个Ta就在不远方,就如漫天繁星,总有一颗属于你!" << endl;
      Sleep(2000);
      cout << "\t\t\t\t\t 快抓紧你身边的那个Ta -oooooo" << endl << endl << endl;
      Sleep(3000);
      system("pause");
      peo[User].award++;
      return 1;
      }
      void Gambler()
      {
      int GameCount = 0;//游戏次数
      int dice1, dice2, dice3, sum;
      int key1 = 0; //进入赌局的钥匙
      srand((unsigned int)time(NULL)); //依据时间生成随机数的种子
      cout << "************************************ 我 是 赌 神 **" << endl;
      cout << " 赌场规则:" << endl;
      cout << " ① 玩家必须缴纳5枚硬币来获取赌场通行证,并确保自己仍有剩余的硬币参与下注;" << endl;
      cout << " ② 进入赌场后,玩家用硬币下注,随后会掷出三枚骰子,玩家需猜测三枚骰子之和为单数还是双数;" << endl;
      cout << " ③ 猜中即可获得双倍奖励,否则将扣除双倍的硬币;" << endl;
      cout << " ④ 若三枚骰子大小相同,则为大满贯,即无论您下的注是否猜中,您都将获得三倍奖励。" << endl;
      cout << " 警告:进入赌场的玩家至少需进行5轮赌注,若强制退出,则视为违约,将扣除您硬币总数的一半" << endl << endl << endl;
      Sleep(3000);
      system("pause");//暂停游戏并熄屏
      system("cls");
      cout << " 我 是 赌 神 **";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t +--------------------------+" << endl;
      cout << "\t\t\t\t\t | 是否进入赌场? |" << endl;
      cout << "\t\t\t\t\t | 1.进入(需缴纳5枚硬币) | " << endl;
      cout << "\t\t\t\t\t | 2.退出赌场 |" << endl;
      cout << "\t\t\t\t\t +--------------------------+" << endl;
      cout << "请输入数字实现对应的功能:";
      int k = Check(2); //只返回1、2(是否进入赌场)
      system("cls"); //清屏
      if (k == 1 && peo[User].coin > 5)
      {
      peo[User].coin -= 5; //扣除5枚硬币作为入场券的费用
      key1 = 1; //赌场开门
      }
      else if (k == 2)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 退出成功!!!" << endl;
      Sleep(3000); //延时3秒
      return;
      }
      else if (peo[User].coin <= 5)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t您的硬币不足,已强制退出" << endl;
      Sleep(3000); //延时3秒
      return;
      }
      if (key1 == 1)
      {
      while (1)
      {
      if (peo[User].coin <= 0) //判断硬币数量是否还能继续游戏
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您倾家荡产,已强制退出" << endl;
      Sleep(3000); //延时3秒
      return;
      }
      int judge = 0;
      cout << " 我 是 赌 神 **" << endl << endl;
      cout << "\t\t您的硬币数量:" << peo[User].coin << "\t\t\t\t\t\t 当前下注次数:" << GameCount << endl << endl;
      cout << "1.开始" << endl;
      cout << "2.退出(下注未满5次会扣除您硬币总数的一半)" << endl;
      cout << "请选择:";
      int Choice = Check(2); //只返回1、2(是否开始游戏)
      if (Choice == 1)
      {
      as: cout << "请输入您要压入硬币的数量(整数):";
      int cn = Check(0); //规范输入 防止系统崩溃
      cout << endl;
      if (cn > peo[User].coin) //下注数大于硬币所有数
      {
      cout << "您的硬币不足!!!" << endl;
      goto as;
      }
      cout << endl;
      cout << "1.单数" << endl;
      cout << "0.双数" << endl;
      cout << "请下注:";
      int Bat = Check(4); //只返回1、0(选择压单或双数)
      system("cls");
      cout << " 我 是 赌 神 **";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 赌局开始!!!" << endl;
      Sleep(2000);
      system("cls");
      cout << " 我 是 赌 神 **";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 第" << ++GameCount << "轮骰子开始掷!" << endl;
      Sleep(2000);
      system("cls");
      dice1 = 1 + rand() % 6;
      dice2 = 1 + rand() % 6;
      dice3 = 1 + rand() % 6; //随机扔三个骰子
      sum = dice1 + dice2 + dice3;
      cout << " 我 是 赌 神 **";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t " << dice1;
      Sleep(1000);
      system("cls");
      cout << " 我 是 赌 神 **";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t " << dice1 << " " << dice2;
      Sleep(1000);
      system("cls");
      cout << " 我 是 赌 神 *";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t " << dice1 << " " << dice2 << " " << dice3;
      Sleep(2000);
      system("cls");
      cout << " 我 是 赌 神 ";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 骰子大小之和为: " << sum << endl;
      Sleep(2000);
      system("cls");
      if (dice1 == dice2 && dice2 == dice3) //判断是否三个骰子数都相同 (即大满贯)
      {
      cout << " 我 是 赌 神 ";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t大满贯,获得3倍奖励!!!" << endl;
      peo[User].coin += 3 * cn;
      judge = 1;
      Sleep(3000);
      system("cls");
      continue;
      }
      if (sum % 2 == Bat)
      {
      cout << " 我 是 赌 神 ";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 猜测正确,双倍奖励!!!" << endl;
      peo[User].coin += 2 * cn;
      Sleep(3000);
      system("cls");
      continue;
      }
      else if (sum % 2 != Bat)
      {
      cout << " 我 是 赌 神 ";
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 猜测错误,硬币扣除" << endl;
      peo[User].coin -= 2 * cn;
      Sleep(3000);
      system("cls"); //清屏
      continue;
      }
      } //押单则bat=1,押双数则bat=0
      else if (Choice == 2) //选择退出游戏
      {
      if (GameCount < 5)
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t 警告:您游戏未满5次,已扣除硬币总数的一半!!!" << endl;
      Sleep(3000); //延时3秒
      peo[User].coin /= 2; //硬币扣除硬币总数一半
      return;
      }
      else
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您全身而退!!!" << endl;
      Sleep(3000); //延时3秒
      return;
      }
      }
      }
      }
      }
      int main()
      {
      system("color F0"); //设置背景色为白色,字体颜色为黑色
      HideCursor(); //影藏光标
      cout << "\t\t\t\t\t\t\n\n\n\n 宗然游戏盒 Version 1.0.0 \n\n\t开源作者:宗然" << endl;
      Sleep(3000); //延时3秒
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t 抵 制 不 良 游 戏 , 拒 绝 盗 版 游 戏 。" << endl;
      cout << "\t\t\t\t\t 注 意 自 我 保 护 , 谨 防 受 骗 上 当 。" << endl;
      cout << "\t\t\t\t\t 适 度 游 戏 益 脑 , 沉 迷 游 戏 伤 身 。" << endl;
      cout << "\t\t\t\t\t 合 理 安 排 时 间 , 享 受 健 康 生 活 。" << endl;
      Sleep(6000); //延时6秒
      system("cls"); //清屏
      while (1)
      {
      while (1)
      {
      MessageBox(NULL,"您好,欢迎使用宗然游戏盒,以下是推广链接\nZongranGameBox官方qq群:677548883 开源首发群\n建议加群(如有新版本,将发布至此群)\n如传播或倒卖此免费资源可耻!\n只有从群里或网站下载的才算正常渠道!!!","宗然游戏盒 v 1 . 0 . 0",MB_YESNO|MB_ICONASTERISK);
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 宗然游戏盒 Version 1.0.0\n\n\t\t\t\t\t\t 官方qq群:677548883\n\n\t\t\t\t\t\t 全服在线人数:1\n\n\t\t\t\t\t\t\tby:宗然\n" << endl;
      cout << "\t\t\t\t\t\t +--------------------+" << endl;
      cout << "\t\t\t\t\t\t | Hi 欢迎回来! |" << endl;
      cout << "\t\t\t\t\t\t | 1.登录 | " << endl;
      cout << "\t\t\t\t\t\t | 2.注册 |" << endl;
      cout << "\t\t\t\t\t\t | 0.忍痛退出程序 |" << endl;
      cout << "\t\t\t\t\t\t +--------------------+\n\n" << endl;
      cout << "开启你的旅程吧:";
      float k = Check(1); //只返回1、2、0
      if (k == 1) //登录
      {
      system("cls"); //清屏
      int a = SignIn();
      if (a == 1) //选择直接进入程序
      {
      Key = 1; //钥匙开锁,可进入主程序
      system("cls"); //清屏
      break;
      }
      else
      {
      continue;
      }
      }
      else if (k == 2) //注册
      {
      system("cls"); //清屏
      int b = Register();
      if (b == 1) //选择直接进入程序
      {
      Key = 1; //钥匙开锁,可进入主程序
      system("cls"); //清屏
      break;
      }
      else if (b == 2) //选择不直接进入程序
      {
      system("cls"); //清屏
      continue;
      }
      }
      else if (k == 0) //退出程序
      {
      cout << "\n呜呜呜!你真的要退出了吗?" << endl;
      cout << "1.强忍离去" << endl;
      cout << "2.我点错了!继续使用!" << endl;
      float a = Check(2);
      cout << endl << endl;
      if (a == 1)
      {
      break;
      }
      else if (a == 2)
      {
      system("cls"); //清屏
      continue;
      }
      }
      }
      if (Key == 1)
      {
      Progress(); //进度条
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 你好!" << peo[User].user << endl;
      cout << "\t\t\t\t\t\t 正在加载游戏菜单 by:宗然" << endl;
      Sleep(3000); //延时3秒
      system("cls"); //清屏
      while (1)
      {
      system("color F0"); //设置背景色为白色,字体颜色为黑色
      cout << " 宗然游戏盒 *****************************************************" << endl;
      cout << " Version 1.0.0 by:宗然\n" << endl;
      cout << " 玩家:" << peo[User].user << setw(15) << "硬币:" << peo[User].coin <<" 使用系统:windows\n\n官方qq群:677548883"<<endl;
      cout << " +------------------+" << endl;
      cout << " | 1.雷霆战机 |" << endl;
      cout << " | 2.愤怒吃豆人 |" << endl;
      cout << " | 3.快乐贪吃蛇 |" << endl;
      cout << " | 4.经典猜数字 |" << endl;
      cout << " | 5.恋爱测试 |" << endl;
      cout << " | 6.澳门赌场 |" << endl;
      cout << " | |" << endl;
      cout << " | |" << endl;
      cout << " | 9.返回主界面 |" << endl;
      cout << " | 0.退出程序 |" << endl;
      cout << " +------------------+\n" << endl;
      cout << "请输入您要游玩的游戏编号:";
      double n = Check(0);
      cout << endl << endl;
      if (n == 1)
      {
      system("cls"); //清屏
      PlaneWar();
      system("cls"); //清屏
      if (Q1 > 200)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏胜利,硬币+30" << endl;
      Sleep(3000);
      system("cls"); //清屏
      peo[User].coin += 30;
      continue;
      }
      else
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
      Sleep(3000);
      system("cls"); //清屏
      continue;
      }
      }
      else if (n == 2)
      {
      system("cls"); //清屏
      ChiDouRen();
      system("cls"); //清屏
      if (Q2 == 0)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏胜利,硬币+10" << endl;
      Sleep(3000);
      system("cls"); //清屏
      peo[User].coin += 10;
      continue;
      }
      else
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
      Sleep(3000);
      system("cls"); //清屏
      continue;
      }
      }
      else if (n == 3)
      {
      system("cls"); //清屏
      if (Death == 1)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 蛇已死,自噬无法复活!!!" << endl;
      Sleep(3000);
      system("cls"); //清屏
      }
      else if (Death == 0)
      {
      tanchishe();
      system("cls"); //清屏
      if (Q3 > 15)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
      Sleep(3000);
      system("cls"); //清屏
      peo[User].coin += 10;
      continue;
      }
      else
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
      Sleep(3000);
      system("cls"); //清屏
      continue;
      }
      }
      }
      else if (n == 4)
      {
      system("cls"); //清屏
      caishuzi();
      system("cls"); //清屏
      if (Guesstimes == 1)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 您运气爆棚,硬币+200" << endl;
      Sleep(3000);
      system("cls"); //清屏
      peo[User].coin += 200;
      continue;
      }
      else if (Guesstimes <= 8)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
      Sleep(3000);
      system("cls"); //清屏
      peo[User].coin += 20;
      continue;
      }
      else
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
      Sleep(3000);
      system("cls"); //清屏
      continue;
      }
      }
      else if (n == 5)
      {
      system("cls"); //清屏
      int GETG = LianAiCeShi();
      system("cls"); //清屏
      if (GETG == 1 && peo[User].award == 1)
      {
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 恋爱测试结束!!!" << endl;
      Sleep(2000);
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t 哈哈!赠送您50硬币,祝您早日找到那个TA!!!" << endl;
      Sleep(2000);
      peo[User].coin += 50;
      system("cls"); //清屏
      }
      continue;
      }
      else if (n == 6)
      {
      system("cls"); //清屏
      Gambler();
      if (peo[User].coin < 0)
      {
      peo[User].coin = 0; //硬币下限为0
      }
      system("cls"); //清屏
      continue;
      }
      else if (n == 9)
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 存档中......" << endl;
      Sleep(2000); //延时2秒
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 即将返回大厅" << endl;
      Sleep(2000); //延时2秒
      system("cls"); //清屏
      Key = 0; //程序关锁
      KeyOut = 1; //钥匙开锁,退出登录
      break;
      }
      else if (n == 0)
      {
      cout << "呜呜,你真的要退出了吗?" << endl;
      cout << "1.强忍离去" << endl;
      cout << "2.继续使用" << endl;
      float a = Check(2);
      cout << endl << endl;
      if (a == 1)
      {
      break;
      }
      else if (a == 2)
      {
      system("cls"); //清屏
      continue;
      }
      }
      else if (n == 12321) //查看所有玩家的信息
      {
      system("cls"); //清屏
      cout << setw(10) << "序号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
      for (int i = 0; i < x; i++)
      {
      cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
      }
      system("pause");
      system("cls"); //清屏
      }
      else if (n == 12345)
      {
      system("cls"); //清屏
      cout << setw(10) << "编号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
      for (int i = 0; i < x; i++)
      {
      cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
      }
      cout << endl << endl << "请输入要修改信息的玩家编号:";
      int fo = Check(0) - 1;
      cout << endl;
      cout << "请输入要修改的信息:" << endl;
      cout << "1.用户名" << endl;
      cout << "2.密码" << endl;
      cout << "3.硬币" << endl;
      int ko = Check(3);
      if (ko == 1)
      {
      cout << endl << "用户名修改为:";
      char us1[1000];
      cin.get();
      cin.getline(us1, 1000);
      strcpy(peo[fo].user, us1);
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
      Sleep(2000); //等待2秒
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
      }
      else if (ko == 2)
      {
      cout << endl << "密码修改为:";
      char us2[1000];
      cin.get();
      cin.getline(us2, 1000);
      strcpy(peo[fo].password, us2);
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
      Sleep(2000); //等待2秒
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
      }
      else if (ko == 3)
      {
      cout << endl << "硬币数量修改为:";
      long long us3 = Check(0);
      peo[fo].coin = us3;
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
      Sleep(2000); //等待2秒
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
      }
      Sleep(2000);
      system("cls"); //清屏
      }
      else
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
      cout << "\t\t\t\t\t 抱歉,您输入的数字不在菜单中,请重新输入!!!" << endl;
      Sleep(2000);
      system("cls"); //清屏
      }
      }
      }
      if (KeyOut == 1)
      {
      KeyOut = 0; //钥匙使用过后关锁,以便后续使用
      continue;
      }
      else if (KeyOut == 0)
      {
      system("cls"); //清屏
      cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << "\t\t\t\t\t\t 亲爱的用户!期待您的下次游玩!\n\n\t\t\t\t\t\t 不要忘记作者宗然!" << endl;
      Sleep(3000); //延时3秒
      break;
      }
      }
      return 0;
      }
      
      

      这才是真的

      • 你在干什么?你在干什么?

        • 1