思路
- 增加了2模式,可以简单地体会到乐趣,再也不用一个一个找数了。
- 一次游戏,一次加载,主要为了美观。
- 无聊的加了一个加载过程。
- 欢迎你们的点赞,关注,支持!你们的鼓励让我努力做一个合格的程序员。
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<windows.h>
void menu()
{
printf("*********************\n");
printf("2.88外挂版 猜数游戏 \n");
printf("* 1.开始 0.结束 *\n");
printf("* 2.0 外挂模式 *\n");
printf("*********************\n");
}
void game()
{
system("cls");
int a = rand()%100+1;
int b = 0;
while (1)
{
printf("开始猜数************\n");
scanf("%d", &b);
if (a > b)
{
printf("数小了***************\n");
printf("重新输入一个大的数***\n");
} // *********************
else if(a < b)
{
printf("数大了***************\n");
printf("重新输入一个小的数***\n");
} // *********************
else
{
printf("恭喜猜到*************\n");
printf("重新加载游戏*********\n");
Sleep(3000);
break;
} // *********************
}
}
void gamew()
{
system("cls");
int c = rand() % 100 + 1;
int d = 0;
while (1)
{
printf("这个数是%d\n",c);
printf("开始猜数************\n");
scanf("%d", &d);
if (c > d)
{
printf("数小了***************\n");
printf("重新输入一个大的数***\n");
} // *********************
else if (c < d)
{
printf("数大了***************\n");
printf("重新输入一个小的数***\n");
} // *********************
else
{
printf("恭喜猜到*************\n");
printf("重新加载游戏*********\n");
Sleep(3000);
break;
} // *********************
}
}
int main()
{
int input = 0;
srand((unsigned int)time(NULL));
do
{
menu();
printf("*******请选择********\n");
scanf("%d", &input);
switch (input)
{
case 1:
game();
system("cls");
printf("游戏加载中");
printf("*\n");
Sleep(1000);
system("cls");
printf("游戏加载中**\n");
Sleep(1000);
system("cls");
printf("游戏加载中***\n");
Sleep(1000);
system("cls");
printf("游戏加载中*\n");
Sleep(1000);
system("cls");
break;
case 0:
system("cls");
printf("*******退出游戏*******\n");
break;
case 2:
gamew();
system("cls");
printf("游戏加载中");
printf("*\n");
Sleep(1000);
system("cls");
printf("游戏加载中**\n");
Sleep(1000);
system("cls");
printf("游戏加载中***\n");
Sleep(1000);
system("cls");
printf("游戏加载中*\n");
Sleep(1000);
system("cls");
break;
default:
system("cls");
printf("*******重新输入*******\n");
break;
}
} while (input);
return 0;
}