跳到正文

剪贴板

剪贴板 0blp73cu

原文
剪贴板信息

剪贴板信息

收录
更新

有朋自远方来,虽远必诛!!!

C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main() {
	int money = 100/*钱的数量*/, c_break/*用于判断是否进行循环*/, shiqing/*通过输入来决定干什么*/, panduan/*对于事情中要判断的条件*/, a = 10/*用于输出战斗力*/, xuanze/* 判断选择哪个区,或者哪个选手*/, s = 0, w = 100, t = 0, k = 0;
	int zd = 100, sl = 1, an1 = 0, flag = 1;
	int maxer = 0, kk = 0, xx = 0, cishu = 1;
	//所有变量定义
	system("color 3");
	cout << "欢迎来到游戏世界!" << endl; //开场白
	do {
		system("color 3");
		Sleep[5000];
		system("pause");
		cout << "游戏开始!" << endl; //准备现示可以做的事情
		cout << "你要干什么呢?" << endl; //提示用户输入
		printf("1.KTV蹦迪\n");
		printf("2.打格斗赛\n");
		printf("3.饭店吃饭\n");
		printf("4.战斗前线\n");
		printf("5.玩猜数字游戏\n");
		cin >> shiqing; //输入干什么
		if (shiqing == 1) {
			cout << "欢迎来到KTV!" << endl;
			cout << "蹦迪需要100元哦,请问你要继续吗?" << endl; //询问顾客是否进行
			cout << "如果要,请输入1,否则请输入2。" << endl; //提示
			cin >> panduan; //输入
			if (panduan == 1) {
				if (money < 100)
					printf("对不起,您的钱不够。\n");
				else {
					system("cls");
					printf("蹦迪开始!!!\n");
					for (int i = 1; i <= 1000; i++)
						cout << 857;
					for (int i = 1; i <= 10; i++) {
						Sleep[5000];
						system("color 0");
						Sleep[5000];
						system("color 1");
						Sleep[5000];
						system("color 2");
						Sleep[5000];
						system("color 3");
						Sleep[5000];
						system("color 4");
						Sleep[5000];
						system("color 5");
						Sleep[5000];
						system("color 6");
						Sleep[5000];
						system("color 7");
						Sleep[5000];
						system("color 8");
						Sleep[5000];
						system("color 9");
						Sleep[5000];
						system("color A");
						Sleep[5000];
						system("color B");
						Sleep[5000];
						system("color C");
						Sleep[5000];
						system("color D");
						Sleep[5000];
					}
					cout << endl;
					money -= 100;
					system("color 3");
					Sleep[100000];
					system("cls");
				}
			}
		}
		if (shiqing == 2) {
			cout << "欢迎来到格斗场!" << endl;
			cout << "您的战斗力为" << a;
			cout << "您要选择哪个区?" << endl;
			cout << "1.简单区" << endl;
			cout << "2.普通区" << endl;
			cout << "3.高级区" << endl;
			cout << "4.噩梦区" << endl;
			cin >> xuanze;
			if (xuanze == 1) {
				s += rand() % 1000;
				s += rand() % 1000;
				s /= 2;
				if (s < 200 || s > 800)
					a -= 2;
				cout << "1.王大葱[战斗力2]_100元" << endl;
				cout << "2.大聪明[战斗力2]_100元" << endl;
				cout << "3.小明[战斗力2]_100元" << endl;
				cin >> xuanze;
				cout << "你要1.攻击还是2.躲避?" << endl;
				cin >> panduan;
				if (panduan == 1) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 200 && s <= 800 && a >= 2) {
						cout << "你赢了!" << endl;
						money += 100;
					} else cout << "不!" << endl;
				}
				if (panduan == 2) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 200 && s <= 800) {
						cout << "你成功地躲了过去!";
					} else {
						a -= 2;
						cout << "不!" << endl;
					}
				}
			} else if (xuanze == 2) {
				s += rand() % 1000;
				s += rand() % 1000;
				s /= 2;
				if (s < 300 || s > 700)
					a -= 3;
				cout << "1.王大葱[战斗力3]_200元" << endl;
				cout << "2.大聪明[战斗力3]_200元" << endl;
				cout << "3.小明[战斗力3]_200元" << endl;
				cin >> xuanze;
				cout << "你要1.攻击还是2.躲避?" << endl;
				cin >> panduan;
				if (panduan == 1) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 250 && s <= 750 && a >= 3) {
						cout << "你赢了!" << endl;
						money += 200;
					} else cout << "不!" << endl;
				}
				if (panduan == 2) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 250 && s <= 750) {
						cout << "你成功地躲了过去!";
					} else {
						a -= 3;
						cout << "不!" << endl;
					}
				}
			} else if (xuanze == 3) {
				s += rand() % 1000;
				s += rand() % 1000;
				s /= 2;
				if (s < 400 || s > 600)
					a -= 4;
				cout << "1.王大葱[战斗力4]_300元" << endl;
				cout << "2.大聪明[战斗力4]_300元" << endl;
				cout << "3.小明[战斗力4]_300元" << endl;
				cin >> xuanze;
				cout << "你要1.攻击还是2.躲避?" << endl;
				cin >> panduan;
				if (panduan == 1) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 500 && s <= 6000 && a >= 4) {
						cout << "你赢了!" << endl;
						money += 200;
					} else cout << "不!" << endl;
				}
				if (panduan == 2) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 500 && s <= 600) {
						cout << "你成功地躲了过去!";
					} else {
						a -= 4;
						cout << "不!" << endl;
					}
				}
			} else if (xuanze == 4) {
				s += rand() % 1000;
				s += rand() % 1000;
				s /= 2;
				if (s < 550 || s > 600)
					a -= 5;
				cout << "1.王大葱[战斗力5]_400元" << endl;
				cout << "2.大聪明[战斗力5]_400元" << endl;
				cout << "3.小明[战斗力5]_400元" << endl;
				cin >> xuanze;
				cout << "你要1.攻击还是2.躲避?" << endl;
				cin >> panduan;
				if (panduan == 1) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 500 && s <= 600 && a >= 5) {
						cout << "你赢了!" << endl;
						money += 400;
					} else cout << "不!" << endl;
				}
				if (panduan == 2) {
					s += rand() % 1000;
					s += rand() % 1000;
					s /= 2;
					if (s >= 550 && s <= 600) {
						cout << "你成功地躲了过去!";
					} else {
						a -= 5;
						cout << "不!" << endl;
					}
				}
			}
		}
		if (shiqing == 3) {
			cout << "欢迎来到饭店!" << endl;
			cout << "你要点什么呢?" << endl;
			printf("1.去年的红烧肉\n2.过期的方便面\n3.老八套餐(厕所大餐)\n");
			cin >> xuanze;
			if (xuanze == 3) {
				cout << "老八走了过来,拉着你去了厕所" << endl;
				cout << "你要吃多少?" << endl;
				printf("1.很多\n2.超级多\n3.全部吃完\n");
				cin >> panduan;
				if (panduan == 3) {
					cout << "老八很生气,后果很严重!" << endl;
					cout << "你掉了20点血" << endl;
					w -= 20;
				} else {
					cout << "你呕吐了。" << endl;
					w -= 10;
				}
			}
			if (xuanze == 1) {
				cout << "食堂阿姨收抖抖抖抖抖抖抖抖......抖抖抖抖抖了亿下" << endl;
				cout << "你成功的没能吃上肉" << endl;
				cout << "你饿极了,掉了50点血。" << endl;
				w -= 50;
			}
			if (xuanze == 2) {
				cout << "你吃下去后,拉了" << endl;
				cout << "损失一条裤子,减少一些血。" << endl;
				w -= 30;
			}
		}
		if (shiqing == 4) {
			if (an1 < 5) {
				cout << "你来到了战斗前线。" << endl;
				printf("你手上有1把AK47,还有%d发子弹与%d个手雷。\n", zd, sl);
				cout << "你要干什么?" << endl;
				cout << "1.AK47全力扫射。" << endl;
				cout << "2.手雷投射。" << endl;
				cin >> panduan;
				if (panduan == 1) {
					s = rand() % 100;
					t = rand() % 100;
					k = (s + t) / 2 / 20;
					printf("你获得了%d个手雷!!!", k);
					cout << "你获得了队长50元的奖励与" << k << "个手雷。" << endl;
					money += 50;
					sl += k;
					an1++;
					zd -= 50;
				}
				if (panduan == 2) {
					if (sl == 0) {
						cout << "你的手雷没了!";
					} else {
						s = rand() % 100;
						t = rand() % 100;
						k = (s + t) / 2;
						printf("你获得了%d发子弹!", k);
					}
				}
			} else {
				if (flag == 0) {
					cout << "你获得了当上队长的机会!" << endl;
					cout << "你当上了队长!" << endl;
					flag = 1;
					s = rand() % 100;
					t = rand() % 100;
					k = (s + t) / 2;
					cout << "你奖励了队员" << k << "元钱!" << endl;
					money -= k;
					cout << "你来到了战斗前线。" << endl;
					printf("你手上有1把AK47,还有%d发子弹与%d个手雷。\n", zd, sl);
					cout << "你要干什么?" << endl;
					cout << "1.AK47全力扫射。" << endl;
					cout << "2.手雷投射。" << endl;
					cin >> panduan;
					if (panduan == 1) {
						s = rand() % 200;
						t = rand() % 200;
						k = (s + t) / 2 / 20;
						printf("你获得了%d个手雷!!!", k);
						cout << "你获得了大队长100元的奖励与" << k << "个手雷。" << endl;
						money += 100;
						sl += k;;
						an1++;
						zd -= 50;
					} else {
						s = rand() % 200;
						t = rand() % 200;
						k = (s + t) / 2;
						printf("你获得了%d发子弹!", k);
					}
				} else {
					s = rand() % 100;
					t = rand() % 100;
					k = (s + t) / 2;
					cout << "你奖励了队员" << k << "元钱!" << endl;
					money -= k;
					cout << "你来到了战斗前线。" << endl;
					printf("你手上有1把AK47,还有%d发子弹与%d个手雷。\n", zd, sl);
					cout << "你要干什么?" << endl;
					cout << "1.AK47全力扫射。" << endl;
					cout << "2.手雷投射。" << endl;
					cin >> panduan;
					if (panduan == 1) {
						s = rand() % 200;
						t = rand() % 200;
						k = (s + t) / 2 / 20;
						printf("你获得了%d个手雷!!!", k);
						cout << "你获得了大队长100元的奖励与" << k << "个手雷。" << endl;
						money += 100;
						sl++;
						an1++;
						zd -= 50;
					} else {
						s = rand() % 100;
						t = rand() % 100;
						k = (s + t) / 2;
						printf("你获得了%d发子弹!", k);
					}
				}
			}
		}
		if (shiqing == 5) {
			cout << "你要猜的数字最大是多少?" << endl;
			cin >> maxer;
			kk = rand() % maxer;
			Sleep[10000];
			cout << "游戏开始!" << endl;
			cout << "猜:";
			cin >> xx;
			while (xx != kk) {
				if (xx > kk)cout << "大了!" << endl;
				if (xx < kk)cout << "小了!" << endl;
				cout << "再来!" << endl;
				cout << "猜:";
				cin >> xx;
				cishu++;
			}
			cout << "你赢了!" << endl;
			Sleep[10000];
			if (xx == 1) cout << "超级欧皇!";
			else if (xx <= 3) cout << "王牌锦鲤!";
			else if (xx <= 5) cout << "运气爆棚!";
			else if (xx <= 8) cout << "标准职业!";
			else if (xx >= 20) cout << "无可药救!";
			cout << endl;
			maxer = 0,
			kk = 0,
			xx = 0,
			cishu = 1;
		}
		if (w <= 0) {
			cout << "你S了。";
			return 0;
		}
		cout << "你还有" << money << "元钱" << endl;
		cout << "你还有" << a << "战斗力" << endl;
		cout << "你还有" << w << "点血" << endl;
		cout << "您如果还想享受游戏,那么请输入1。如果玩累了,请输入2来退出。" << endl;
		//提示语,来提示用户输入c_break来判断
		cin >> c_break;
		//输入循环条件
	} while (c_break == 1);
	//根据每次循环的是否继续输入来进行循环
	system("cls");
	return 0;
}