当前位置:首页 » 《随便一记》 » 正文

【c++】运动会1.0_饼干的博客

19 人参与  2022年05月29日 10:18  分类 : 《随便一记》  评论

点击全文阅读


最近学校开运动会

我心血来潮做了这个小游戏

挺好玩的

不过暂时只有跑步这个比赛

之后会加别的比赛的

对了,本游戏需要下载b_game库3.0(作者自己做的)

#include<iostream>
#include<conio.h>
#include<windows.h>
#include<D:\b_game.h>
#include<ctime>
#include<cstdlib>
using namespace std;
using namespace _game;
bool cx_flag = 1;
long long ydjf = 0, pbjl = 1000000000000000000;
//页面函数
void zy();
//功能函数
void cd_in();
void cd_out();
//模式函数
void paobu();
int main()
{
	srand(time(0));
	gckdx(30, 100);
	ycbj();
	gckm("运动会");
	ycgb();
	yanse(7);
	system("cls");
	cout << "正在读入数据...";
	cd_in();
	system("cls");
	bout("一年一度的运动会开始了...");
	cout << "\n\n" << "按任意键继续...";
	_getch();
	system("cls");
	bout("这次,你又要参加什么比赛呢?");
	cout << "\n\n" << "按任意键继续...";
	_getch();
	system("cls");
	while (cx_flag)
	{
		zy();
	}
	system("cls");
	cout << "正在储存数据...";
	cd_out();
	return 0;
}
void zy()
{
	short _n = 0;
	char s;
	system("cls");
	if (ydjf > 0)
	{
		cout << "运动积分:" << ydjf << "\n";
		_n++;
	}
	if (pbjl != 1000000000000000000)
	{
		cout << "跑步最高记录:" << pbjl / 1000.0 << "秒\n";
		_n++;
	}
	for (long long i = 1; i <= 8 - _n; i++)
		cout << "\n";
	cout << "                                         运动会";
	cout << "\n\n\n                                         0.退出";
	cout << "\n\n\n                                         1.跑步";
	s = _getch();
	while (s != '0' && s != '1')s = _getch();
	switch (s)
	{
	case '0':
		cx_flag = 0;
		return;
	case '1':
		paobu();
		break;
	}
	return;
}
void cd_in()
{
	cdhs _cd;
	_cd.in(ydjf, "运动积分.binggan");
	_cd.in(pbjl, "跑步记录.binggan");
	return;
}
void cd_out()
{
	cdhs _cd;
	_cd.out(ydjf, "运动积分.binggan");
	_cd.out(pbjl, "跑步记录.binggan");
	return;
}
void paobu()
{
	bool flag = 1, f = 0;
	system("cls");
	long long s[6], lc[6] = { 0,1,1,1,1,1 }, y_lc[6] = { 0,1,1,1,1,1 }, yl[6] = { 0,1,1,1,1,1 }, mc = 1, t_1, t_2;
	for (long long i = 1; i <= 5; i++)
	{
		s[i] = rand() % 3 + 4;
		y_lc[i] = lc[i];
	}
	cout << "\n\n\n";
	cout << "---------------------------------------------------------------------------------------\n";
	cout << "|";
	yanse(9);
	cout << "o";
	yanse(7);
	cout << "===============================================================================|=====\n";
	cout << "|";
	yanse(9);
	cout << "o";
	yanse(7);
	cout << "===============================================================================|=====\n";
	cout << "|";
	yanse(10);
	cout << "o";
	yanse(7);
	cout << "===============================================================================|=====\n";
	cout << "|";
	yanse(9);
	cout << "o";
	yanse(7);
	cout << "===============================================================================|=====\n";
	cout << "|";
	yanse(9);
	cout << "o";
	yanse(7);
	cout << "===============================================================================|=====\n";
	cout << "---------------------------------------------------------------------------------------\n";
	cout << "\n----------------------------------------------------------------------------------------------------";
	cout << "说明:\n";
	cout << "    空格 前进\n";
	yanse(10);
	cout << "    o ";
	yanse(7);
	cout << "你\n";
	yanse(9);
	cout << "    o ";
	yanse(7);
	cout << "对手\n";
	for (long long i = 1; i <= 5; i++)
		y_lc[i] = lc[i];
	t_1 = clock();
	for (long long cs = 1; flag; cs++)
	{
		//输入
		if (axj(' '))
		{
			if (!f)
			{
				f = 1;
				lc[3]++;
			}
		}
		else f = 0;
		//检测
		for (long long i = 1; i <= 5; i++)
		{
			if (cs % ((10 - s[i]) * 2) == 0)
			{
				if (i != 3 && yl[i])
				{
					lc[i]++;
				}
			}
		}
		for (long long i = 1; i <= 5; i++)
		{
			if (lc[i] > 80 && yl[i])
			{
				if (i == 3)
				{
					yanse(7);
					system("cls");
					t_2 = clock();
					cout << "你得了第" << mc << "名\n";
					if (mc == 1)
					{
						ydjf += 10;
						cout << "运动积分+10\n";
					}
					if (t_2 - t_1 < pbjl)
					{
						pbjl = t_2 - t_1;
						cout << "你打破了你的记录\n";
						cout << "运动积分+30\n";
						ydjf += 30;
					}
					cout << "\n按Enter键继续";
					while (!axj(Enter));
					system("cls");
					cd_out();
					return;
				}
				else
				{
					yl[i] = 0;
					mc++;
				}
			}
		}
		//更新游戏
		for (long long i = 1; i <= 5; i++)
		{
			if (y_lc[i] != lc[i])
			{
				ydgb(i + 4, y_lc[i] + 1);
				yanse(7);
				cout << "=";
				if (i == 3)
				{
					yanse(10);
				}
				else
				{
					yanse(9);
				}
				ydgb(i + 4, lc[i] + 1);
				cout << "o";
			}
		}
		for (long long i = 1; i <= 5; i++)
			y_lc[i] = lc[i];
		Sleep(1);
	}
	return;
}


点击全文阅读


本文链接:http://m.zhangshiyu.com/post/40978.html

跑步  积分  运动  
<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新文章

  • 山海不相逢内容精选(温逸尘沈衿)_山海不相逢内容精选(温逸尘沈衿)
  • (番外)+(全书)霍沉洲沈青禾此去经年人未还(霍沉洲沈青禾)_(霍沉洲沈青禾此去经年人未还)列表_笔趣阁(霍沉洲沈青禾)
  • (番外)+(全书)霍沉洲沈青禾(此去经年人未还霍沉洲沈青禾)完结_(霍沉洲沈青禾)列表_笔趣阁(此去经年人未还霍沉洲沈青禾)
  • 「重回八零,拒绝替嫁冲喜」章节彩蛋限时释出‌_卫东玉兰苏夏人气小说未删减节选
  • 重生七零祁同伟不再是农民儿子结局+番外纯净版全书免费重生七零祁同伟不再是农民儿子结局+番外纯净版全书免费
  • 傅雅宁的神女老婆,却在背地承欢作乐顾尘傅雅宁全书在线
  • 全文神女老婆,却在背地承欢作乐全局(顾尘傅雅宁)列表_全文神女老婆,却在背地承欢作乐全局
  • (番外)+(全书)此去经年人未还全书+番外+后续免费下载_(沈青禾霍沉洲)此去经年人未还全书+番外+后续列表_笔趣阁(沈青禾霍沉洲)
  • 完结文毁容的姐姐和瞎眼的我离开后,姜家两兄弟悔哭了+后续列表_完结文毁容的姐姐和瞎眼的我离开后,姜家两兄弟悔哭了+后续(林梦婉)
  • 妻子辱我爸受贿自杀,我掏出一等军功章节选推荐_[陈素云辰朋友]小说精彩章节分享
  • 全书浏览苔藓爬满旧日诺言新上(顾砚廷慕晚夏)_苔藓爬满旧日诺言新上(顾砚廷慕晚夏)全书结局
  • 顾尘傅雅宁(神女老婆,却在背地承欢作乐+后续+结局)结局_(顾尘傅雅宁神女老婆,却在背地承欢作乐+后续+结局全书结局)结局列表_笔趣阁(顾尘傅雅宁)

    关于我们 | 我要投稿 | 免责申明

    Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1