其实就是加了个动态进度条显示加载游戏的流程,这样看上去是不是更有big了hhhh
#include<windows.h>
#include<iostream>
#include<ctime>
using namespace std;
void menu()
{printf("1.开始游戏\n");printf("0.退出游戏\n");
}
void game()
{int guess;int ret = rand() % 100 + 1;while (1){printf("请猜数字:");scanf("%d", &guess);if (guess < ret){printf("猜小了,再试试吧。\n");}else if (guess > ret){printf("猜大了,再猜一猜。\n");}else{printf("恭喜猜对!\n");break;}}
}
void load() {for (int i = 0; i <= 100; i++) {cout << "正在加载:|" << i << '%';for (int j = 0; j <= i; j++) {cout << '-';}Sleep(100);//cout<<endl;if (i != 100)system("cls");}cout << "加载完成|\n游戏开始!";
}
int main() {int input = 0;srand((unsigned int)time(NULL));do{menu();printf("请选择:");scanf("%d", &input);switch (input){case 1:load();game();break;case 0:printf("已退出游戏!\n");break;default:printf("该选项尚未开发。\n");break;}} while (input);return 0;
}