- js27115 的博客
游戏13——G币人生2.0
- @ 2026-2-25 20:41:22
原作太牛逼了,竟然是开出一声黄金甲的ssssssssssssssssssss级学长大佬!
https://www.bcoi.cn/d/hgjs/blog/545/6922b478b1c8cab1a66e7a0e#1763882104253
所以原作者你什么时候补后面的剧情,你都一个月没更新了
游戏1-12:https://www.bcoi.cn/d/hgjs/blog/598
#include<windows.h>
#include<iostream>
#include<string>
using namespace std;
int xing;
int G=50;
string c;
void sanb(string g, int s) {
int delay = 250;
if (s == 2) delay = 125;
else if (s == 3) delay = 25;
for (int i = 0; i < (int)g.size(); i++) {
char ch = g[i];
Sleep(delay);
cout << ch;
cout.flush();
}
cout << endl;
}
void d(int day) {
cout << "第";
Sleep(250);
cout << day;
Sleep(250);
cout << "天";
Sleep(1500);
system("cls");
}
bool isValidInput(char choice, int minVal, int maxVal) {
return choice >= '0' + minVal && choice <= '0' + maxVal;
}
string intToString(int num) {
char buffer[20];
sprintf(buffer, "%d", num);
return string(buffer);
}
int main() {
sanb("这是一个改编自学长做的神秘小游戏,", 3);
Sleep(500);
sanb("你需要通过不同的方式赚取G币,并且成功活下去。", 3);
Sleep(1250);
system("cls");
sanb(" 加载中 ", 3);
sanb("...................", 2);
Sleep(250);
system("cls");
sanb(" G币人生2.0 ", 3);
sanb("1.开始游戏 2.劳资才不玩", 3);
cout << endl;
while (true) {
// 清空输入缓冲区
cin.clear();
cin >> c;
system("cls");
if (c.empty()) continue;
if (c[0] == '1') break;
else if (c[0] == '2') {
sanb("想啥呢,不玩也得玩", 3);
Sleep(1000);
break;
} else {
sanb("输入无效!请选择1或2", 3);
}
}
system("cls");
for (int i = 1; i <= 10; i++) {
cout << endl << " 开始游戏";
Sleep(25);
system("cls");
Sleep(25);
}
cout << endl << " 开始游戏";
Sleep(750);
system("cls");
d(1);
Sleep(250);
system("cls");
sanb(" 你要选择: ", 3);
sanb("1.富贵家庭 2.普通家庭", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 3)) {
sanb("输入无效!请选择1、2或3", 3);
continue;
}
if (c[0] == '1') {
sanb("恭喜你:获得10000G币!", 3);
Sleep(2000);
system("cls");
sanb("上小学后,你有999999999G币巨款,你被盯上了…", 3);
Sleep(1000);
system("cls");
sanb(" 你选择 ", 3);
sanb("1.逃跑 2.殊死一搏", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 2)) {
sanb("输入无效!请选择1或2", 3);
continue;
}
if (c[0] == '1') {
sanb("你逃跑时绊到石头摔死了!", 3);
cout << "解锁结局:走路不看路";
return 0;
} else if (c[0] == '2') {
sanb("你被打了一拳,感觉屎要被打出来了", 3);
Sleep(1000);
system("cls");
sanb(" 你选择 ", 3);
sanb("1.错了错了,我是猪波,别打! 2.你没吃饭么?", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 2)) {
sanb("输入无效!请选择1或2", 3);
continue;
}
if (c[0] == '1') {
sanb("那个人说:你觉得我会信么,你长得跟头猪一样", 3);
Sleep(1250);
sanb("你被打死了", 3);
cout << "解锁结局:点击输入文字";
return 0;
} else if (c[0] == '2') {
sanb("坏人很生气,一巴掌直接给你从老北京打到法国巴黎", 3);
Sleep(1250);
sanb("你被打死了", 3);
cout << "解锁结局:乱装逼的后果";
return 0;
}
}
}
}
} else if (c[0] == '2') {
break;
} else if (c[0] == '3') {
sanb("恭喜你,触发了999999999999999分之一的人才能触发的隐藏……", 3);
Sleep(1500);
sanb("金币大礼包!", 3);
Sleep(500);
sanb("假的啦,是重开大礼包!", 2);
cout << "解锁结局:不是谁都有幸运的时候";
return 0;
}
}
system("cls");
sanb(" 性别选择: ", 3);
sanb("1.男生 2.女生 3.不男不女 4.雌雄同体", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 4)) {
sanb("输入无效!请选择1-4", 3);
continue;
}
if (c[0] == '1') {
sanb("护士:恭喜啊!是个男生!", 3);
xing = 1;
Sleep(1250);
sanb("系统消息:出生成功,奖励G币50。", 3);
G += 50;
cout << "你的性别为:男生(编码:" << xing << ")" << endl;
Sleep(500);
break;
} else if (c[0] == '2') {
sanb("护士:恭喜啊!是个女生!", 3);
xing = 2;
Sleep(1250);
sanb("系统消息:出生成功,奖励G币50。", 3);
G += 50;
cout << "你的性别为:女生(编码:" << xing << ")" << endl;
Sleep(500);
break;
} else if (c[0] == '3' || c[0] == '4') {
string tip = (c[0] == '3') ? "沃尔玛购物袋!" : "武装直升机!";
sanb("护士:恭喜啊,是个" + tip, 3);
Sleep(1250);
sanb("你的父母十分害怕,把你丢弃了", 3);
cout << "解锁结局:活了不到1秒,创下人类史上最短命纪录";
return 0;
}
}
system("cls");
sanb("你父母很高兴,把你带回了家,在家中,你收到了赐福", 3);
Sleep(1000);
system("cls");
if (xing == 1) {
sanb(" 你选择 ", 3);
sanb("1.背带裤达人 2.牢九门战神", 3);
} else {
sanb(" 你选择 ", 3);
sanb("1.蒙面女郎 2.邻家少女", 3);
}
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 2)) {
sanb("输入无效!请选择1或2", 3);
continue;
}
if (c[0] == '1') {
string tip = (xing == 1) ? "背带裤达人,魅力+3,艺术天赋+5" : "蒙面女郎,魅力+3,艺术天赋+5";
sanb("你选择了" + tip, 3);
} else {
string tip = (xing == 1) ? "牢九门战神,学习天赋+10" : "邻家少女,学习天赋+10";
sanb("你选择了" + tip, 3);
}
Sleep(1000);
break;
}
// 替换to_string为兼容函数
sanb("系统消息:G币到达100,解锁基础商城。当前G币:" + intToString(G), 3);
Sleep(1000);
system("cls");
d(2);
Sleep(1250);
system("cls");
sanb("你可以说话了(就是这样设定的,不要觉得奇怪),你第一句话要说:", 3);
sanb("1.老豆 2.老木 3.你猜猜你会说什么 4.商城", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 4)) {
sanb("输入无效!请选择1-4", 3);
continue;
}
if (c[0] == '1') {
sanb("你的父亲十分的高兴", 3);
} else if (c[0] == '2') {
sanb("你的母亲十分的高兴", 3);
} else if (c[0] == '3') {
sanb("你说出了少羽的招牌技", 3);
Sleep(1250);
sanb("你死了", 3);
cout << "解锁结局:乱说话导致的后果";
return 0;
} else if (c[0] == '4') {
cout << "当前G币:" << G << endl;
sanb(" 你选择 ", 3);
sanb("1.工地孤鸿寡鹄 2.肺炎互粉 3.怀旧服7日游", 3);
while (true) {
cin.clear();
cin >> c;
system("cls");
if (c.empty() || !isValidInput(c[0], 1, 3)) {
sanb("输入无效!请选择1-3", 3);
continue;
}
if (c[0] == '1') {
sanb("你的家出现了一种鸟,你收养了它", 3);
} else if (c[0] == '2') {
sanb("你不小心感染了肺炎,在家休养", 3);
} else if (c[0] == '3') {
sanb("你沉迷怀旧服7日游,浪费了一周时间", 3);
}
break;
}
}
break;
}
sanb("游戏未完待续...", 3);
return 0;
}
其实早期设置潮玩社区的时候就已经玩过这个游戏了,但是接连不断的报错使这个花季少年陷入了深谷,所以就放弃收录了。不过还好我给它修补成功了,不然还不知道这个哎呀我滴妈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈游戏会在博客里吃多少灰。
注意:该代码仅适用于 Windows 系统,在 Linux/macOS 上需要修改系统相关函数(Sleep、cls 清屏等)才能运行
好了就先写到这里,再会!