跳到正文

闲话

Minecraft

Fantasy25约 49 分钟
原文
文章信息与版本

文章信息

发布
2025年11月26日
收录
2026年10月3日
更新
2026年11月22日
篇幅
约 49 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <unistd.h>
#include <windows.h> 
#define sleep(i) Sleep(500) 
#define endl '\n'
using namespace std;
int zzz;
int money = 500;
int fangyu = 0;
int shanghai = 1;
int xueliang = 20;
bool baoji = false;
bool zouwei = false; 
int hengsao = 7;
bool hengsao2 = false;
bool guoguan = false;
int fenglifumomoney[5] = {50,100,150,200,300};
int fenglifumolevel = 0;
int hengsaofumomoney[3] = {50,100,200};
int hengsaofumolevel = 0;
int baohufumolevel = 0;
int baohufumomoney[4] = {60,130,200,300};
int jinpingguo = 2;
int yaoshui = 2;
int maozifangyulevel = 0;
int xiongjiafangyulevel = 0;
int hutuifangyulevel = 0;
int xuezifangyulevel = 0;
int wuqilevel = 0;
int maozi[6] = {20,50,100,130,170,230};
int maozifangyu[6] = {1,2,3,4,5,8};

int xiongjia[6] = {40,70,120,160,200,360};
int xiongjiafangyu[6] = {2,4,6,7,8,12};

int hutui[6] = {25,55,110,140,180,320};
int hutuifangyu[6] = {2,3,5,6,7,10};

int xuezi[6] = {15,45,90,120,150,290};
int xuezifangyu[6] = {1,2,3,4,5,6};

int wuqi[6] = {10,20,35,50,70,100};
int wuqishanghai[6] = {3,4,5,6,7,8};

string dangqianmaozi[6] = {"皮革帽子","锁链头盔","铁头盔","金头盔","钻石头盔","下界合金头盔"};
string dangqianxiongjia[6] = {"皮革衣服","锁链胸甲","铁胸甲","金胸甲","钻石胸甲","下界合金胸甲"};
string dangqianhutui[6] = {"皮革裤子","锁链护腿","铁护腿","金护腿","钻石护腿","下界合金护腿"};
string dangqianxuezi[6] = {"皮革靴子","锁链靴子","铁靴子","金靴子","钻石靴子","下界合金靴子"};
string dangqianwuqi[6] = {"木剑","石剑","铁剑","金剑","钻石剑","下界合金剑"}; 
void zhuangbei()
{
	while (1)
	{
		cout << "1.头盔" << endl;
		cout << "2.胸甲" << endl;
		cout << "3.护腿" << endl;
		cout << "4.靴子" << endl;
		cout << "5.武器" << endl;
		cout << "6.附魔" << endl; 
		cout << "7.退出" << endl;
		cin >> zzz;
		system("cls");
		if (zzz == 7) return ;
		else if (zzz == 1)
		{
			while(1)
			{
				cout << "1.皮革帽子(+1%防御力)(20马内)" << endl;
				cout << "2.锁链头盔(+2%防御力)(50马内)" << endl;
				cout << "3.铁头盔(+3%防御力)(100马内)" << endl;
				cout << "4.金头盔(+4%防御力)(130马内)" << endl;
				cout << "5.钻石头盔(+5%防御力)(170马内)" << endl;
				cout << "6.下界合金头盔(+8%防御力)(300马内)" << endl;
				cout << "7.返回上一级" << endl;
				cout << "当前拥有:";
				if (maozifangyulevel == 0) cout << "无" << endl;
				else cout << dangqianmaozi[maozifangyulevel - 1] << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 7) break;
				else
				{
					if (zzz < 1 || zzz > 7)
					{
						cout << "请不要乱输!" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					if (money < maozi[zzz - 1])
					{
						cout << "你的马内不够" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else
					{
						if (maozifangyulevel > zzz)
						{
							cout << "你已经有更高级的装备了" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else if (maozifangyulevel == zzz)
						{
							cout << "你已拥有此装备" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							if (maozifangyulevel == 0)
							{
								fangyu += maozifangyu[zzz - 1];
							}
							else
							{
								fangyu -= maozifangyu[maozifangyulevel - 1];
								fangyu += maozifangyu[zzz - 1];
							}
							maozifangyulevel = zzz;
							money -= maozi[zzz - 1];
							continue;
						}
						
					}
				}
			}
			continue;
		}
		else if (zzz == 2)
		{
			while(1)
			{
				cout << "1.皮革衣服(+2%防御力)(40马内)" << endl;
				cout << "2.锁链胸甲(+4%防御力)(70马内)" << endl;
				cout << "3.铁胸甲(+6%防御力)(120马内)" << endl;
				cout << "4.金胸甲(+7%防御力)(160马内)" << endl;
				cout << "5.钻石胸甲(+8%防御力)(200马内)" << endl;
				cout << "6.下界合金胸甲(+12%防御力)(360马内)" << endl;
				cout << "7.返回上一级" << endl; 
				cout << "当前拥有:";
				if (xiongjiafangyulevel == 0) cout << "无" << endl;
				else cout << dangqianxiongjia[xiongjiafangyulevel - 1] << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 7) break;
				else
				{
					if (zzz < 1 || zzz > 7)
					{
						cout << "请不要乱输!" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					if (money < xiongjia[zzz - 1])
					{
						cout << "你的马内不够" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else
					{
						if (xiongjiafangyulevel > zzz)
						{
							cout << "你已经有更高级的装备了" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else if (xiongjiafangyulevel == zzz)
						{
							cout << "你已拥有此装备" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							if (xiongjiafangyulevel == 0)
							{
								fangyu += xiongjiafangyu[zzz - 1];
							}
							else
							{
								fangyu -= xiongjiafangyu[xiongjiafangyulevel - 1];
								fangyu += xiongjiafangyu[zzz - 1];
							}
							xiongjiafangyulevel = zzz;
							money -= xiongjia[zzz - 1];
							continue;
						}
						
					}
				}
			}
			continue;
		}
		else if (zzz == 3)
		{
			while(1)
			{
				cout << "1.皮革裤子(+2%防御力)(25马内)" << endl;
				cout << "2.锁链护腿(+3%防御力)(55马内)" << endl;
				cout << "3.铁护腿(+5%防御力)(110马内)" << endl;
				cout << "4.金护腿(+6%防御力)(140马内)" << endl;
				cout << "5.钻石护腿(+7%防御力)(180马内)" << endl;
				cout << "6.下界合金护腿(+10%防御力)(320马内)" << endl;
				cout << "7.返回上一级" << endl;
				cout << "当前拥有:";
				if (hutuifangyulevel == 0) cout << "无" << endl;
				else cout << dangqianhutui[hutuifangyulevel - 1] << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 7) break;
				else
				{
					if (zzz < 1 || zzz > 7)
					{
						cout << "请不要乱输!" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					if (money < hutui[zzz - 1])
					{
						cout << "你的马内不够" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else
					{
						if (hutuifangyulevel > zzz)
						{
							cout << "你已经有更高级的装备了" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else if (hutuifangyulevel == zzz)
						{
							cout << "你已拥有此装备" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							if (hutuifangyulevel == 0)
							{
								fangyu += hutuifangyu[zzz - 1];
							}
							else
							{
								fangyu -= hutuifangyu[hutuifangyulevel - 1];
								fangyu += hutuifangyu[zzz - 1];
							}
							hutuifangyulevel = zzz;
							money -= hutui[zzz - 1];
							continue;
						}
						
					}
				}
			}
			continue;
		}
		else if (zzz == 4)
		{
			while(1)
			{
				cout << "1.皮革靴子(+1%防御力)(15马内)" << endl;
				cout << "2.锁链靴子(+2%防御力)(45马内)" << endl;
				cout << "3.铁靴子(+3%防御力)(90马内)" << endl;
				cout << "4.金靴子(+4%防御力)(120马内)" << endl;
				cout << "5.钻石靴子(+5%防御力)(150马内)" << endl;
				cout << "6.下界合金靴子(+6%防御力)(290马内)" << endl;
				cout << "7.返回上一级" << endl;
				cout << "当前拥有:";
				if (xuezifangyulevel == 0) cout << "无" << endl;
				else cout << dangqianxuezi[xuezifangyulevel - 1] << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 7) break;
				else
				{
					if (zzz < 1 || zzz > 7)
					{
						cout << "请不要乱输!" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					if (money < xuezi[zzz - 1])
					{
						cout << "你的马内不够" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else
					{
						if (xuezifangyulevel > zzz)
						{
							cout << "你已经有更高级的装备了" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else if (xuezifangyulevel == zzz)
						{
							cout << "你已拥有此装备" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							if (xuezifangyulevel == 0)
							{
								fangyu += xuezifangyu[zzz - 1];
							}
							else
							{
								fangyu -= xuezifangyu[xuezifangyulevel - 1];
								fangyu += xuezifangyu[zzz - 1];
							}
							xuezifangyulevel = zzz;
							money -= xuezi[zzz - 1];
							continue;
						}
						
					}
				}
			}
			continue;
		}
		else if (zzz == 5)
		{
			while(1)
			{
				cout << "1.木剑(+3攻击力)(10马内)" << endl;
				cout << "2.石剑(+4攻击力)(20马内)" << endl;
				cout << "3.铁剑(+5攻击力)(35马内)" << endl;
				cout << "4.金剑(+6攻击力)(50马内)" << endl;
				cout << "5.钻石剑(+7攻击力)(70马内)" << endl;
				cout << "6.下界合金剑(+8攻击力)(100马内)" << endl;
				cout << "7.返回上一级" << endl;
				cout << "当前拥有:";
				if (wuqilevel == 0) cout << "无" << endl;
				else cout << dangqianwuqi[wuqilevel - 1] << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 7) break;
				else
				{
					if (zzz < 1 || zzz > 7)
					{
						cout << "请不要乱输!" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					if (money < wuqi[zzz - 1])
					{
						cout << "你的马内不够" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else
					{
						if (wuqilevel > zzz)
						{
							cout << "你已经有更高级的武器了" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else if (wuqilevel == zzz)
						{
							cout << "你已拥有此武器" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							if (wuqilevel == 0)
							{
								shanghai = wuqishanghai[zzz - 1];
							}
							else
							{
								shanghai -= wuqishanghai[wuqilevel - 1];
								shanghai += wuqishanghai[zzz - 1];
							}
							wuqilevel = zzz;
							money -= wuqi[zzz - 1];
							continue;
						}
						
					}
				}
			}
			continue;
		}
		else if (zzz == 6)
		{
			while (1)
			{
				if (fenglifumolevel + 1 <= 5)
				{
					cout << "1.锋利" << fenglifumolevel + 1 << "(" << fenglifumomoney[fenglifumolevel] << "马内)" << endl;
				}
				else
				{
					cout << "1.锋利5" << endl;
				}
				if (hengsaofumolevel + 1 <= 3)
				{
					cout << "2.横扫之刃" << hengsaofumolevel + 1 << "(" << hengsaofumomoney[hengsaofumolevel] << "马内)" << endl;
				}
				else
				{
					cout << "2.横扫之刃3" << endl; 
				}
				if (baohufumolevel + 1 <= 4)
				{
					cout << "3.保护" << baohufumolevel + 1 << "(" << baohufumomoney[baohufumolevel] << "马内)" << endl;
				}
				else
				{
					cout << "3.保护4" << endl; 
				}
				cout << "4.返回上一级" << endl;
				cout << "当前附魔为:" << endl; 
				cout << "锋利:";
				if (fenglifumolevel == 0) cout << "无" << endl;
				else cout << fenglifumolevel << "级" << endl; 
				cout << "横扫之刃:";
				if (hengsaofumolevel == 0) cout << "无" << endl;
				else cout << hengsaofumolevel << "级" << endl;
				cout << "保护:";
				if (baohufumolevel == 0) cout << "无" << endl;
				else cout << baohufumolevel << "级" << endl; 
				cout << "你还有" << money << "马内" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 1)
				{
					if (fenglifumolevel + 1 > 5)
					{
						cout <<  "已经是最高级了" << endl;
						sleep(1);
						system("cls");
						continue;
					}
					else if (wuqilevel == 0)
					{
						cout << "你还没有武器,不能附魔" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else
					{
						if (money < fenglifumomoney[fenglifumolevel])
						{
							cout << "你的马内不够" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							fenglifumolevel += 1;
							money -= fenglifumomoney[fenglifumolevel - 1];
							shanghai += 2;
							continue;
						}
						
					}
				}
				else if (zzz == 2)
				{
					if (hengsaofumolevel + 1 > 3)
					{
						cout << "已经是最高级了" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else if (wuqilevel == 0)
					{
						cout << "你还没有武器,不能附魔" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else
					{
						if (money < hengsaofumomoney[hengsaofumolevel])
						{
							cout << "你的马内不够" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							hengsaofumolevel += 1;
							money -= hengsaofumomoney[hengsaofumolevel - 1];
							hengsao -= 2;
							continue;
						}
					}
				}
				else if (zzz == 3)
				{
					if (baohufumolevel + 1 > 4)
					{
						cout << "已经是最高级了" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else if (maozifangyulevel == 0 && xiongjiafangyulevel == 0 && hutuifangyulevel == 0 && xuezifangyulevel == 0)
					{
						cout << "你还没有装备,不能附魔" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else
					{
						if (money < baohufumomoney[baohufumolevel])
						{
							cout << "你的马内不够" << endl;
							sleep(1);
							system("cls");
							continue;
						}
						else
						{
							cout << "购买成功!" << endl;
							sleep(1);
							system("cls");
							baohufumolevel += 1;
							money -= baohufumomoney[baohufumolevel - 1];
							fangyu += 10;
							continue;
						}
					}
				}
				else if (zzz == 4)
				{
					break;
				}
				else
				{
					cout << "请不要乱输!" << endl;
					sleep(1);
					system("cls");
					continue;
				}
			}
		}
		else
		{
			cout << "请不要乱输!" << endl;
			sleep(1);
			system("cls");
			continue;
		}
	}
}
void yaoping()
{
	while (1)
	{
		cout << "1.金苹果(20马内)(当前拥有" << jinpingguo << "个)" << endl;
		cout << "2.恢复药水(30马内)(当前拥有" << yaoshui << "个)" << endl;
		cout << "3.使用药品" << endl;
		cout << "4.退出" << endl;
		cout << "你有" << money << "马内" << endl;
		cin >> zzz;
		system("cls");
		if (zzz == 1)
		{
			if (money < 20)
			{
				cout << "你的马内不够" << endl;
				sleep(1);
				system("cls");
				continue;
			}
			else
			{
//				cout << "购买成功!" << endl;
				money -= 20;
				jinpingguo++;
//				sleep(1);
				system("cls");
				continue;
			}
		}
		else if (zzz == 2)
		{
			if (money < 30)
			{
				cout << "你的马内不够" << endl;
				sleep(1);
				system("cls");
				continue;
			}
			else
			{
//				cout << "购买成功!" << endl;
				money -= 30;
				yaoshui++;
//				sleep(1);
				system("cls");
				continue;
			}
		}
		else if (zzz == 3)
		{
			while (1)
			{
				cout << "1.吃金苹果(可回复12滴血)(当前拥有" << jinpingguo << "个)" << endl;
				cout << "2.喝恢复药水(可回复15滴血)(当前拥有" << yaoshui << "瓶)" << endl;
				cout << "3.返回上一级" << endl;
				cout << "你当前有" << xueliang << "滴血" << endl;
				cin >> zzz;
				system("cls");
				if (zzz == 1)
				{
					if (jinpingguo == 0)
					{
						cout << "你的金苹果不够" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else
					{
						cout << "使用成功!" << endl;
						if (xueliang + 12 > 20)
						{
							cout << "你还剩20血量" << endl; 
							xueliang = 20;
						}
						else
						{
							xueliang += 12;
							cout << "你还剩" << xueliang << "滴血" << endl;
						}
						jinpingguo--;
					}
					Sleep(1000);
					system("cls");
					continue;
				}
				else if (zzz == 2)
				{
					if (yaoshui == 0)
					{
						cout << "你的恢复药水不够" << endl;
						sleep(1);
						system("cls");
						continue; 
					}
					else
					{
						cout << "使用成功!" << endl;
						if (xueliang + 15 > 20)
						{
							cout << "你还剩20血量" << endl; 
							xueliang = 20;
						}
						else
						{
							xueliang += 15;
							
							cout << "你还剩" << xueliang << "滴血" << endl;
						}
						yaoshui--;
						Sleep(1000);
						system("cls");
						continue;
					}
				}
				else if (zzz == 3)
				{
					break;
				}
				else
				{
					cout << "请不要乱输!" << endl;
					sleep(1);
					system("cls");
					continue;
				}
			}
		}
		else if (zzz == 4)
		{
			return ;
		}
		else
		{
			cout << "请不要乱输!" << endl;
			sleep(1);
			system("cls");
			continue;
		}
	}
}
void jiangshi()
{
	srand((int)time(NULL));
	int jiang = rand() % 20 + 1;
	while (1)
	{
		cout << "你遇到了" << jiang << "只僵尸" << endl;
		cout << "请问你要打吗?" << endl;
		cout << "1.要\n2.不要" << endl;
		cin >> zzz;
		system("cls");
		if (zzz == 1) break;
		else if (zzz == 2) return ;
		else
		{
			cout << "请不要乱输!" << endl;
			sleep(1);
			system("cls");
			continue;
		}
	}
	int jiangshang = 1.0 * 2 * jiang * 1.0 * (100 - fangyu) / 100;
	int jiangxue = 20 * jiang;
	int hengsaojiangshi;
	while (1)
	{
		if (jiangxue <= 0)
		{
			cout << "僵尸被你打败了" << endl;
			srand((int)time(NULL));
			int hadmoney = (((rand() + rand() * 2 / 7 + 23) + 10) % 100 + 10) * jiang;
			cout << "你获得了" << hadmoney << "马内" << endl;
			money += hadmoney;
			Sleep(2000);
			system("cls");
			return ;
		}
		cout << "他们还剩下" << jiangxue << "滴血" << endl;
		if (!zouwei)
		{
			cout << "他们打掉你" << jiangshang << "滴血" << endl;
			xueliang -= jiangshang;
		}
		if (xueliang <= 0)
		{
			cout << "你还剩下0滴血" << endl;
			Sleep(900);
			system("cls");
			return ;
		}
		while (1)
		{
			zouwei = false;
			cout << "你还剩下" << xueliang << "滴血" << endl;
			cout << "请问你现在要做什么?" << endl;
			cout << "1.攻击" << endl;
			cout << "2.逃跑" << endl;
			cout << "3.吃金苹果(当前拥有" << jinpingguo << "个)(可回复12血量)" << endl;
			cout << "4.喝恢复药水(当前拥有" << yaoshui << "瓶)(可回复15血量)" << endl; 
			cin >> zzz;
			system("cls");
			srand((int)time(NULL));
			if (zzz == 1)
			{
				if (rand() % 5 == 3) baoji = true;
				if (rand() % hengsao == 0) hengsao2 = true;
				if (rand() % 2 == 1) zouwei = true;
				if (zouwei)
				{
					cout << "你成功走位了" << endl;
				}
				if (baoji && !hengsao2 )
				{
					cout << "你打掉了他们" << shanghai * 2 << "滴血" << endl;
					jiangxue -= shanghai * 2;
					baoji = false;
				}
				else if (hengsao2 && !baoji)
				{
					hengsaojiangshi = rand() % jiang + 1;
					if (hengsaojiangshi > jiang) hengsaojiangshi = jiang;
					cout << "你横扫了" << hengsaojiangshi << "只僵尸" << endl; 
					cout << "你打掉了他们" << shanghai * hengsaojiangshi << "滴血" << endl;
					jiangxue -= shanghai * hengsaojiangshi;
					hengsao2 = false;
				}
				else if (hengsao2 && baoji)
				{
					hengsaojiangshi = rand() % jiang + 1;
					cout << "你横扫了" << hengsaojiangshi << "只僵尸" << endl;
					cout << "你打掉了他们" << shanghai * hengsaojiangshi * 2 << "滴血" << endl;
					jiangxue -= shanghai * hengsaojiangshi * 2;
					baoji = false;
					hengsao2 = false;
				}
				else
				{
					cout << "你打掉了他们" << shanghai << "滴血" << endl;
					jiangxue -= shanghai;
				}
				break;
			}
			else if (zzz == 2)
			{
				return ;
			}
			else if (zzz == 3)
			{
				if (jinpingguo == 0)
				{
					cout << "你的金苹果不够" << endl;
					sleep(1);
					system("cls");
					continue; 
				}
				else
				{
					cout << "使用成功!" << endl;
					if (xueliang + 12 > 20)
					{
						cout << "你还剩20血量" << endl; 
						xueliang = 20;
					}
					else
					{
						xueliang += 12;
						cout << "你还剩" << xueliang << "滴血" << endl;
					}
					jinpingguo--;
					break;
				}
			}
			else if (zzz == 4)
			{
				if (yaoshui == 0)
				{
					cout << "你的恢复药水不够" << endl;
					sleep(1);
					system("cls");
					continue; 
				}
				else
				{
					cout << "使用成功!" << endl;
					if (xueliang + 15 > 20)
					{
						cout << "你还剩20血量" << endl; 
						xueliang = 20;
					}
					else
					{
						xueliang += 15;
						cout << "你还剩" << xueliang << "滴血" << endl;
					}
					yaoshui--;
					break;
				}
			}
			else
			{
				cout << "请不要乱输!" << endl;
				sleep(1);
				system("cls");
				continue;
			}
		}
	}
	
}
void diaoling()
{
	for (int i = 0; i < 2; i++)
	{
		Sleep(500);
		system("color 6F");
		cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << "                                          ";
		cout << "!!!危险预警!!!" << endl;
		Sleep(500);
		system("cls");
		Sleep(500);
		system("color 4F");
		cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << "                                          ";
		cout << "!!!危险预警!!!" << endl;
		Sleep(500);
		system("cls");
	}
	system("color 7");
	int diaoxue = 600;
	int diaoshang;
	srand((int)time(NULL));
	while (1)
	{
		if (diaoxue <= 0)
		{
			cout << "凋零被你打败了" << endl;
			Sleep(2000);
			system("cls");
			guoguan = true;
			return ;
		}
		diaoshang = 1.0 * (rand() % 35 + 3) * (1.0 * (100 - fangyu) / 100);
		cout << "它还剩下" << diaoxue << "滴血" << endl;
		cout << "它打掉你" << diaoshang << "滴血" << endl;
		xueliang -= diaoshang;
		if (xueliang <= 0)
		{
			cout << "你还剩下0滴血" << endl;
			Sleep(1000);
			system("cls");
			return ;
		}
		while (1)
		{
			cout << "你还剩下" << xueliang << "滴血" << endl;
			cout << "请问你现在要做什么?" << endl;
			cout << "1.攻击" << endl;
			cout << "2.逃跑" << endl;
			cout << "3.吃金苹果(当前拥有" << jinpingguo << "个)(可回复12血量)" << endl;
			cout << "4.喝恢复药水(当前拥有" << yaoshui << "瓶)(可回复15血量)" << endl; 
			cin >> zzz;
			system("cls");
			if (zzz == 1)
			{
				if (rand() % 5 == 3) baoji = true;
				if (baoji)
				{
					cout << "你打掉了它" << shanghai * 2 << "滴血" << endl;
					diaoxue -= shanghai * 2;
					baoji = false;
				}
				else
				{
					cout << "你打掉了它" << shanghai << "滴血" << endl;
					diaoxue -= shanghai;
				}
				break;
			}
			else if (zzz == 2)
			{
				return ;
			}
			else if (zzz == 3)
			{
				if (jinpingguo == 0)
				{
					cout << "你的金苹果不够" << endl;
					sleep(1);
					system("cls");
					continue; 
				}
				else
				{
					cout << "使用成功!" << endl;
					if (xueliang + 12 > 20)
					{
						cout << "你还剩20血量" << endl; 
						xueliang = 20;
					}
					else
					{
						xueliang += 12;
						cout << "你还剩" << xueliang << "滴血" << endl;
					}
					jinpingguo--;
					break;
				}
			}
			else if (zzz == 4)
			{
				if (yaoshui == 0)
				{
					cout << "你的恢复药水不够" << endl;
					sleep(1);
					system("cls");
					continue; 
				}
				else
				{
					cout << "使用成功!" << endl;
					if (xueliang + 15 > 20)
					{
						cout << "你还剩20血量" << endl; 
						xueliang = 20;
					}
					else
					{
						xueliang += 15;
						cout << "你还剩" << xueliang << "滴血" << endl;
					}
					yaoshui--;
					break;
				}
			}
			else
			{
				cout << "请不要乱输!" << endl;
				sleep(1);
				system("cls");
				continue;
			}
		}
	}
}
void zhuangtai()
{
	cout << "你的血量:" << xueliang << endl;
	cout << "你的马内:" << money << endl;
	cout << "你的防御:" << fangyu << "%" << endl;
	cout << "你的攻击:" << shanghai << "滴血" << endl;
	cout << "你的金苹果:" << jinpingguo << "个" << endl;
	cout << "你的恢复药水:" << yaoshui << "瓶" << endl;
	cout << "你拥有的装备:" << endl;
	if (maozifangyulevel == 0)
	{
		cout << "帽子:无" << endl;
	}
	else
	{
		cout << "帽子:" << dangqianmaozi[maozifangyulevel - 1] << endl;
	}
	if (xiongjiafangyulevel == 0)
	{
		cout << "胸甲:无" << endl;
	}
	else
	{
		cout << "胸甲:" << dangqianxiongjia[xiongjiafangyulevel - 1] << endl;
	} 
	if (hutuifangyulevel == 0)
	{
		cout << "护腿:无" << endl;
	}
	else
	{
		cout << "护腿:" << dangqianhutui[hutuifangyulevel - 1] << endl;
	} 
	if (xuezifangyulevel == 0)
	{
		cout << "靴子:无" << endl;
	}
	else
	{
		cout << "靴子:" << dangqianxuezi[xuezifangyulevel - 1] << endl;
	}
	if (wuqilevel == 0)
	{
		cout << "武器:无" << endl;
	}
	else
	{
		cout << "武器:" << dangqianwuqi[wuqilevel - 1] << endl;
	}
	cout << "锋利:";
	if (fenglifumolevel == 0) cout << "无" << endl;
	else cout << fenglifumolevel << "级" << endl; 
	cout << "横扫之刃:";
	if (hengsaofumolevel == 0) cout << "无" << endl;
	else cout << hengsaofumolevel << "级" << endl;
	cout << "保护:";
	if (baohufumolevel == 0) cout << "无" << endl;
	else cout << baohufumolevel << "级" << endl;
	Sleep(5000);
	system("cls");
	return ;
}
int main(){
	srand((int)time(NULL));
	int sum = 0;
	while(1)
	{
		cout << "正在加载......" << sum << "%" << endl;
		cout << "------------" << endl;
		cout << "|";
		for (int i = 1; i <= sum / 10; i++)
		{
			cout << "/";
		}
		cout << setw(12 - sum / 10) << "|>" << endl;
		cout << "------------" << endl;
		if (rand() % 2 == 0)
		{
			Sleep(30);
		}
		else
		{
			Sleep(rand() % 3);
		}
		sum += rand() % 5;
		if (sum >= 100)
		{
			system("cls");
			cout << "正在加载......100%" << endl;
			cout << "------------\n|//////////|>\n------------\n";
			Sleep(600);
			break;
		}
		system("cls");
	}
	system("cls");
	while (1)
	{
		cout << "你是一个史蒂夫" << endl;
		cout << "你住在一个村庄里" << endl;
		cout << "你的村庄被一只凋零统治了,你需要去打败它" << endl;
		cout << "当然你的实力是有限的,你需要去打僵尸赚钱并购买装备" << endl;
		cout << "1.装备铺" << endl;
		cout << "2.药瓶铺" << endl;
		cout << "3.打僵尸" << endl;
		cout << "4.打凋零" << endl;
		cout << "5.查看你的状态" << endl;
		cin >> zzz;
		system("cls");
		if (zzz == 1)
		{
			zhuangbei();
			continue;
		 }
		else if (zzz == 2)
		{
			yaoping();
			continue;
		}
		else if (zzz == 3)
		{
			jiangshi();
			if (xueliang <= 0) break;
			continue;
		}
		else if (zzz == 4)
		{
			diaoling();
			if (xueliang <= 0) break;
			if (guoguan) break;
		}
		else if (zzz == 5)
		{
			zhuangtai();
			continue;
		}
		else
		{
			cout << "请不要乱输!" << endl;
			sleep(1);
			system("cls");
			continue;
		}
	}
	if (guoguan)
	{
		cout << "你通关了!" << endl;
		sleep(1);
		return 0;
	} 
	else
	{
		cout << "你死了!" << endl;
		sleep(1);
		return 0;
	}
	return 0;
}
原文