我自制的c++小游戏(1.0.0版)

闲聊 已结
30 878
4664946 2024-08-07
//!!!!最新版本在评论区!!!!2.0.0实验版 //1.1.4. #include <bits/stdc++.h> #include <windows.h> #include <stdlib.h> using namespace std; //system("color 7E"); /* 其中color后面的0是背景色代号,A是前景色代号。各颜色代码如下: 0=黑色,1=蓝色,2=绿色,3=湖蓝色,4=红色,5=紫色; 6=黄色,7=白色,8=灰色,9=淡蓝色,A=淡绿色,B=浅绿色; C=淡红色,D=淡紫色,E=淡黄色,F=亮白色。 */ string a[50]; int cn ; void _open(){ MessageBox(NULL,"....游戏即将开始!....","提示",MB_OK|MB_ICONEXCLAMATION); } void CPt(char s, int color){ //彩色输出 HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color); printf("%c",s); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7); } /* color: 0 = 黑色 8 = 灰色 1 = 蓝色 9 = 淡蓝色 2 = 绿色 10 = 淡绿色 3 = 浅绿色 11 = 淡浅绿色 4 = 红色 12 = 淡红色 5 = 紫色 13 = 淡紫色 6 = 黄色 14 = 淡黄色 7 = 白色 15 = 亮白色 */ void _1slowcout(string s){ int ti=20;//you can change the number int u=s.size(); for (int i = 0; i < u; i++) { cout << s[i]; Sleep(ti); } cout<<endl; } void _slowcout(string s, long long int ti) { int u = s.size(); for (int i = 0; i < u; i++) { cout << s[i]; Sleep(ti); } } void c_slowcout(string s, long long int ti,int color) { int u = s.size(); for (int i = 0; i < u; i++) { CPt(s[i],color); Sleep(ti); } } void _start() { c_slowcout("-------------生存游戏--------------\n", 30,6); _open(); Sleep(1000); cout << " " << "作者:Leng" << endl; c_slowcout("------------版本1.1.1 -------------",100,1); cout << endl; Sleep(980); c_slowcout("1.1.4(2改版)版本升级点: \n", 89,2); Sleep(800); /* cout << "1.修复了一些乱码及文字问题" << endl; Sleep(510); cout << "2.新增彩色页面 \n"; Sleep(500); */ _slowcout("1.适用于c++5.12及以上的编译器\n", 50); cout << endl; Sleep(510); _slowcout("2.修复了一些小问题\n", 50); cout << endl; Sleep(510); _slowcout("3.新增彩色页面\n", 50); Sleep(1010); cn = 5; c_slowcout("注意事项:", 91 , 4); cout << endl; _slowcout("1.如果拿不定主意,可以输入数字5。求助次数为5。", 50); _slowcout("\n2.输入6,结束游戏", 50); cout << endl; Sleep(500); cout << "输入任意字符开始游戏" << endl; int as; cin >> as; } int _end() { cout << "是否结束游戏?\n1.是\n2.否\n"; int r; cin >> r; return r; } void _help(int s) { if (cn == 0) { cout << "提示次数为0!"; Sleep(880); cout << "\033c"; system("cls"); cout << a[s] << endl; return; } int u = cn; if (s == 2) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 7) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 8) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 9) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 13) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 14) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 15) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 16) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 17) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 18) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 20) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 21) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 23) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 27) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 28) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 29) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 30) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 32) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 36) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 37) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 40) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } //Sleep(2000); if (cn == u) { cout << "输入任意字符继续"; Sleep(1800); } system("cls"); cout << a[s] << endl; return; /* if(s==2){ cout<<"May be 2"<<endl; cn--; cout<<"剩余提示次数:"<<cn<<endl; sleep(500); cout << "\033c"; } */ } /* 这是一个c++小游戏。(程序自创,文章内容参考《牛津英汉双语读物·入门级·上<生存游戏>》) 1.1.0 版本升级点: 1.修复了一些乱码及a[24]、a[36]的文字问题 2.新增help功能 */ int main() { system("color 0E"); a[1] = "你名叫xx,正驾驶一架小型飞机飞越落基山脉。突然,发动机发出了奇怪的响声,飞机朝着一座山坠去。你的无线电失灵了,没有人知道你所在的位置。\n输入0继续"; a[2] = "你穿着外套,拿着威士忌和地图,过了大约20分钟。积雪很厚,你感到很冷。\n1你回到飞机上,拿了一些其他物品。\n2为了暖和一点,你喝了威士忌。"; a[3] = "你回去睡觉,再也没听到直升机的声响。第2天,你继续沿着河边走。"; a[4] = "你原路返回,出了隧道,走进乱石丛生的山谷。"; a[5] = "你吃了果子。虽然味道不好,但是你太饿了,还是吃了不少。你带了些果子在身上,过后可以吃。"; a[6] = "你穿着外套,拿着香蕉和打火机,走了大约20分钟。积雪很厚,你感到很冷。你回到树林,生起火堆。"; a[7] = "又到了晚上,但因为之前吃了鱼,你并没有觉得饿。你在树下搭了一座帐棚。早上醒来后,你听到了一阵响声。\n你跑出帐棚往天上看,发现有一架直升机。虽然你看得直升机,但因为树枝的遮挡,飞机上的人看不到你。飞机就要飞走了。\n1你追着直升机跑。\n2你回棚里睡觉。\n3你生起了火堆。 \n4你冲着直升机一边大声呼喊,一边挥动双臂。"; a[8] = "你顺着山谷走出很远,夜晚将要来临了。你在树林里生起了火,吃了香蕉。第2天早上,你感到很饿,必须找些东西吃。你在雪地上发现了动物的脚印,也许你可以猎杀这只动物作食物。\n1你沿着脚印追踪走去。\n2你很害怕大型动物。或许这只动物很危险,于是你向山下走去。"; a[9] = "你带着香蕉、打火机和地图走了几分钟,感到非常寒冷。\n1你生起火堆?。\n2你回到飞机上去取威士忌。"; a[10] = "时间到了下午。你开始觉得很不舒服。也许那些果子有毒。你走不动了,坐在雪地上,觉得越来越冷。"; a[11] = "你向右转,飞机撞到了树上。"; a[12] = "你横穿湖面,在冰上走。几分钟后,冰裂开了,你掉进了冰窟窿。"; a[13] = "你带着威士忌、打火机和香蕉走了几分钟,感到非常寒冷。\n1你喝了威士忌。\n2你回到飞机上,放下了威士忌,带上了外套。"; a[14] = "河面上结了冰,但中间有洞隙。你看到河里有鱼。也许你可以抓一条鱼吃。\n1你试着从冰隙间捉几条鱼。\n2在河边捉鱼很危险。你继续往前走。"; a[15] = "你向左转,想在雪地上着陆。飞机落在雪中,停了下来。你虽然安全了,但却身处山顶,天异常寒冷。天黑了下来。 \n1你待在飞机上。\n2你向山下走去。"; a[16] = "山谷的岩石很难攀爬,几分钟之后你就疲惫不堪了。\n1你继续沿着山谷走。\n2你往回走,出了山谷,进了隧道。"; a[17] = "你穿过树林向山下走,感觉饥肠辘辘。你看到有一棵树上结着没见过的果子。\n1你吃了果子。\n2你不吃果子。"; a[18] = "你小心地走上湖面。走了几百米后,脚下的冰开始晃动。\n1你继续在湖面上穿行。\n2你退了回去,然后绕着湖走。"; a[19] = "你重新生起火堆。大概两个小时后,你又听到了直升机的声响。这一次,飞机看到了烟,停在了你旁边的雪地上。这下你安全了。你乘飞机前往医院,可以在那里吃饭和休息。"; a[20] = "你极快地向林中坠去,但你可以让飞机向左转弯或向右转弯。右边是一些树,左边是厚厚的积雪。\n1你向右转。\n2你向左转。"; a[21] = "你继续沿着河走,感觉非常饥饿,必须找东西吃。树上有果子,河中有鱼。\n1你尝试着抓一条鱼。\n2你吃了一些果子。"; a[22] = "绳子断了。"; a[23] = "你继续在雪中跋涉。没有吃的东西,但你可以生火,还可以喝雪水。突然,你发现前面有一个结了冰的湖。\n1你横穿湖面。这样会快一些,你必须找点吃的东西。\n2你绕着湖走。你去寻找条河。"; a[24] = "你待在飞机上,但感到异常寒冷。你真的不想活了吗?"; a[25] = "你在飞机上待了四天,什么也看不到,什么也听不到。你必须下山。"; a[26] = "经过几十分钟的努力,你终于捉到了一条鱼。你又多捉了几条。你感到很冷,于是生起了火堆,烤了几条鱼吃。味道好极了。"; a[27] = "你朝山下走去。几分钟后看到前面有一条隧道。你的左侧还有一个布满岩石的山谷。\n1你沿着山谷走去。\n2你走进隧道。"; a[28] = "你绕着湖走。走约大了五公后,你发现了一条河。河水从湖中流出,向远处流去。\n1你继续绕着湖走。\n2你沿着河走去。"; a[29] = "你想下山。飞机上有一些东西,你可以随身带上几样。你会带哪些呢?\n1外套、威士忌和地图。\n2外套、香蕉和打火机。\n3香蕉、打火机和地图。\n4威士忌、打火机和香蕉。"; a[30] = "一整天,烟不停地升上天空,但是直升机没有出现。你等了一整天。第2天,你一大早就醒来了。\n1你重新生起火堆。\n2你沿着河走去。"; a[31] = "你追着直升机跑,但它飞得很快。你不得不往山上爬,在厚厚的雪中跋涉了一整天,但再也没找到那架直升机。"; a[32] = "你待在飞机附近。坐在一边,看着天,就这样过了两天。什么也没有发生。\n1你待在飞机附近。\n2你试着向山下走去。"; a[33] = "你走进隧道。漆黑一片。你看到有一盏灯,便点上了。"; a[34] = "为了暖和一点儿,你喝了威士忌,但并没有觉得暖和起来。你只是感到很累,筋疲力尽。"; a[35] = "你生起火堆,火堆冒出很多烟。你看着冲天的烟柱。"; a[36] = "你整晚都坐在树林里的火堆前。虽然天很冷,但火烧得很旺,你可以稍微睡一会。你需要想想天亮以后你可以做些什么。\n1你待在飞机附近。\n2你朝山下走去。"; a[37] = "你冲着直升机一边大声呼喊,一边挥动双臂。直升机掉头往回飞了一会,然后向天上飞去。\n1你追着直升机跑。\n2你回去睡觉。\n3你生起火堆。"; a[38] = "你绕着湖走了1整圈,筋疲力尽,没有找到任何事物。你只能沿着河走。"; a[39] = "你沿着脚印在树林中走了很远。脚印延伸到1棵大树的后面。你朝树后看去,看到了一只大熊。这肯定不是能吃的。你悄悄地离开了。"; a[40] = "你向洞的深处走,走了约5分钟,发现地上有一个很大的洞。1条很旧的绳向下直延伸到洞中。\n1你顺着绳子下到洞中。\n2你退回到隧道口。"; cn = 5; _start(); int s = 1; //cout << "\033c"; system("cls"); while (1) { system("color 0E"); int b, c = 0, d = 0, e; if (s == 1) { _1slowcout(a[s]); s = 20; cin >> b; //cout << "\033c"; } else if (s == 2) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 29; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 3) { _1slowcout(a[s]); cin >> b; s = 21; //cout << "\033c"; } else if (s == 4) { _1slowcout(a[s]); cin >> b; s = 16; //cout << "\033c"; //system("cls"); } else if (s == 5) { _1slowcout(a[s]); s = 10; cin >> b; //cout << "\033c"; } else if (s == 6) { _1slowcout(a[s]); s = 36; cin >> b; //cout << "\033c"; } else if (s == 7) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } if (b == 4) { s = 37; } //cout << "\033c"; } else if (s == 8) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 39; } if (b == 2) { s = 17; } //cout << "\033c"; } else if (s == 9) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 36; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 10) { _1slowcout(a[s]); cin >> b; s = 1; //cout << "\033c"; } else if (s == 11) { _1slowcout(a[s]); cin >> b; //cout << "\033c"; s = 1; } else if (s == 12) { _1slowcout(a[s]); cin >> b; //cout << "\033c"; } else if (s == 13) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 34; } if (b == 2) { s = 6; } //cout << "\033c"; } else if (s == 14) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 15) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 24; } if (b == 2) { s = 29; } //cout << "\033c"; } else if (s == 16) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 8; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 17) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 5; } if (b == 2) { s = 23; } //cout << "\033c"; } else if (s == 18) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 12; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 19) { _1slowcout(a[s]); Sleep(500); system("cls"); c_slowcout(" GAME OVER!",40,9); Sleep(300); break; //cout << "\033c"; } else if (s == 20) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 11; } if (b == 2) { s = 15; } //cout << "\033c"; } else if (s == 21) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 5; } //cout << "\033c"; } else if (s == 22) { _1slowcout(a[s]); cin >> b; s = 1; //cout << "\033c"; } else if (s == 23) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 18; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 24) { _1slowcout(a[s]); cin >> b; s = 29; //cout << "\033c"; } else if (s == 25) { _1slowcout(a[s]); cin >> b; s = 27; //cout << "\033c"; } else if (s == 26) { _1slowcout(a[s]); cin >> b; s = 7; //cout << "\033c"; } else if (s == 27) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 16; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 28) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 38; } if (b == 2) { s = 14; } //cout << "\033c"; } else if (s == 29) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 2; } if (b == 2) { s = 6; } if (b == 3) { s = 9; } if (b == 4) { s = 13; } //cout << "\033c"; } else if (s == 30) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 19; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 31) { _1slowcout(a[s]); cin >> b; s = 23; //cout << "\033c"; } else if (s == 32) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 25; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 33) { _1slowcout(a[s]); cin >> b; s = 40; //cout << "\033c"; } else if (s == 34) { _1slowcout(a[s]); cin >> b; s = 1; //cout << "\033c"; } else if (s == 35) { _1slowcout(a[s]); cin >> b; s = 30; //cout << "\033c"; } else if (s == 36) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 32; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 37) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } //cout << "\033c"; } else if (s == 38) { _1slowcout(a[s]); cin >> b; s = 14; //cout << "\033c"; } else if (s == 39) { _1slowcout(a[s]); cin >> b; s = 17; //cout << "\033c"; } else if (s == 40) { _1slowcout(a[s]); cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 22; } if (b == 2) { s = 4; } //cout << "\033c"; } if (b == 6) { if (_end() == 1) { _1slowcout("退出中......"); Sleep(810); system("cls"); break; } } system("cls"); system("color 0E"); /* if(s==){ cout<<a[s]<<endl; cin>>b; cout << "\033c"; } */ } //cout << "\033c"; //cout << "\033c"; }
回帖
  • 2024-08-25 12:06
    #include<iostream> #include<string> #include<cstdio> #include<windows.h> #include<conio.h> #include<algorithm> using namespace std; const int text1=17500000; const int text2=88; const unsigned long long LLMAX=9223372036854775807; void COLOR_PRINT(char s, int color){ //彩色输出 HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color); printf("%c",s); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7); } //借用 https://blog.****.net/qq_42885747/article/details/103835671 void col_string(string s,int color){ //彩色输出 int len=s.length(); for(int i=0;i<len;i++){ COLOR_PRINT(s[i],color); } } void slow(int x,char c,int y){ //缓慢输出 for(int i=1;i<=x;i++){ COLOR_PRINT(c,8); for(int j=1;j<=y;j++); } } void stp(int x){ //停止 for(int i=1;i<=x;i++); } string doc[50]{ //输出文档 "\n这里有两个数字黑洞:", "1.冰雹猜想", "2.圣经数", "冰雹猜想定义:\n对任意一个自然数n,如果他是奇数则对它乘3加1;\n如果它是偶数,则对它除以2。\n\n如此反复运算,最终都能够得到1。即", "奇数:n = 3×n+1\n偶数:n = n÷2", "圣经数定义:任意取一个是3的倍数的自然数。\n求出这个数各个数位上的立方和,得到一个新数;\n然后再求出这个新数各个数位上的立方和,又得到一个新数。\n\n如此重复运算下去,最后一定掉入数字黑洞153之中。" "例如:\n69是3的倍数,按照数字黑洞153的规则,它的变换规则如下:\n6^3+9^3=945,9^3+4^3+5^3=918,9^3+1^3+8^3=1242,1^3+2^3+4^3+2^3=81,8^3+1^3=513,5^3+1^3+3^3=153,……", "请输入黑洞编号(1或2,其他返回主界面)。" }; void sstr(int x,string s,int col){ //col_string与slow的结合 int len=s.length(); for(int i=0;i<len;i++){ COLOR_PRINT(s[i],col); for(int j=1;j<=x;j++); } } /* 8^3+1^3=513, 5^3+1^3+3^3=153, */ long long str_ll(string s){ //string转long long int len=s.size(); long long ans=0; for(int i=0;i<len;i++){ ans = ans*10+s[i]-'0'; } return ans; } unsigned long long str_ull(string s){ //string转unsigned long long int len=s.size(); unsigned long long ans=0; for(int i=0;i<len;i++){ ans = ans*10+s[i]-'0'; } return ans; } long long pow3(int x){ //立方,圣经数用(当时不会使cmath pow) return x*x*x; } /* 0 = 黑色 8 = 灰色 1 = 蓝色 9 = 淡蓝色 2 = 绿色 10 = 淡绿色 3 = 浅绿色 11 = 淡浅绿色 4 = 红色 12 = 淡红色 5 = 紫色 13 = 淡紫色 6 = 黄色 14 = 淡黄色 7 = 白色 15 = 亮白色 */ int main(){ // cout<<str_ll("123")<<endl; //前奏 slow(45,'-',7800000); slow(5,'*',7800000); // cout<<doc[5]; printf("数"); stp(8000000); printf("字"); stp(8000000); printf("黑"); stp(8000000); printf("洞"); stp(8000000); slow(5,'*',7800000); slow(45,'-',7800000); cout<<endl; while(true){ sstr(15000000,"\n主页面\n1.数字黑洞\n2.数字黑洞定义\n3.update\n请输入1,2,3中的一个数字,其他数字退出程序。",4); int a; cin>>a; if(a==1){ while(true){ //正片开始 sstr(text1,doc[0],14); cout<<endl; sstr(text1,doc[1],14); cout<<endl; sstr(text1,doc[2],14); cout<<endl<<endl; sstr(text1,doc[6],14); cout<<endl; int n; cin>>n; if(n==1){ //冰雹猜想 while(true){ col_string("请输入一个正整数(-1退出,切换黑洞):\n",4); string s; cin>>s; if(s=="-1"){ break; } if(s=="0"){ col_string("错误!请输入一个正整数!\n",4); continue; } if(s=="-"){ col_string("错误!请输入一个数!\n",4); continue; } bool flag1=false; //小数 int cnt1=0; bool flag3=false; //符号 int len=s.length(); for(int i=0;i<len;i++){ if(s[i]=='.'){ if(i==0){ flag3 = true; } else if(!flag3){ flag1 = true; } cnt1++; } else if(i==0&&s[i]=='-'){ continue; } else if(s[i]<'0'||s[i]>'9'){ flag3 = true; } } if(s[0]=='-'){ if(s.length()==1||flag3||flag1){ col_string("错误!请输入一个数!\n",4); } else{ col_string("错误!请输入一个正整数!\n",4); } continue; } if(flag3){ col_string("错误!请输入一个数!\n",4); continue; } if(flag1){ if(cnt1>1){ col_string("错误!请输入一个数!\n",4); continue; } col_string("错误!请输入一个整数!\n",4); continue; } unsigned long long nb=str_ull(s); if((len>19||(len==19&&nb>(unsigned long long)(9223372036854775807)))){ col_string("输入的数太大,请输入一个小于等于9223372036854775807的数!\n",4); continue; } long long num=str_ll(s); //黑洞部分 int cnt=1; while(true){ long long tmp=num; string tmp2; if(num%2==1){ //奇数 if((unsigned long long)(tmp*3+1)>LLMAX){ col_string("变换数值过大……\n",4); break; } num = num*3+1; tmp2 = "*3+1 = "; } else{ //偶数 num /= 2; tmp2 = "/2 = "; } col_string("第"+to_string(cnt)+"次变换:"+to_string(tmp)+tmp2+to_string(num)+";\n",14); stp(88); if(num==1){ col_string("……\n\n",4); break; } cnt++; } } } else if(n==2){ //圣经数 while(true){ col_string("请输入一个是3的倍数的正整数(-1退出,切换黑洞):\n",4); string s; cin>>s; if(s=="-1"){ break; } if(s=="0"){ col_string("错误!请输入一个正整数!\n",4); continue; } if(s=="-"){ col_string("错误!请输入一个数!\n",4); continue; } bool flag1=false; int cnt1=0; bool flag3=false; bool flag4=false; int len=s.length(); long long sum=0; for(int i=0;i<len;i++){ if(s[i]=='.'){ if(i==0){ flag3 = true; } else if(!flag3){ flag1 = true; } cnt1++; } else if(i==0&&s[i]=='-'){ continue; } else if(s[i]<'0'||s[i]>'9'){ flag3 = true; } } if(s[0]=='-'){ if(s.length()==1||flag3||flag1){ col_string("错误!请输入一个正整数!\n",4); } col_string("错误!请输入一个正整数!\n",4); continue; } if(flag3){ col_string("错误!请输入一个数!\n",4); continue; } if(flag1){ if(cnt1>1){ col_string("错误!请输入一个数!\n",4); continue; } col_string("错误!请输入一个整数!\n",4); continue; } if(sum%3!=0){ col_string("请输入一个是3的倍数的整数!\n",4); continue; } unsigned long long nb=str_ull(s); if(len>19||(len==19&&nb>(unsigned long long)(9223372036854775807))){ col_string("输入的数太大,请输入一个小于等于9223372036854775807的数!\n",4); continue; } // if(flag1){ // if(flag4){ // col_string("错误!请输入一个正整数!\n",4); // // continue; // } // // if(cnt1>1){ // col_string("错误!请输入一个数!\n",4); // // continue; // } // // col_string("错误!请输入一个整数!\n",4); // // continue; // } // else if(flag3){ // col_string("错误!请输入一个数!\n",4); // // continue; // } long long num=str_ll(s); int cnt=0; while(true){ cnt++; if(num==153){ col_string("……\n\n",4); break; } long long tmp=num; long long sum=0; string s; while(tmp){ int g=tmp%10; sum += pow3(g); tmp /= 10; s += to_string(g)+"^3+"; } int len=s.length(); s.erase(len-1); col_string("第"+to_string(cnt)+"次变换:"+s+"="+to_string(sum)+";\n",14); num = sum; } } } else{ break; } } } else if(a==2){ sstr(19876543,"\n在浩瀚的宇宙中,存在着一种其质量巨大而体积却十分微小的天体,它有着无比强大的引力,能够吞噬任何在它附近的物质,就连光也无法逃脱。\n在天文学中,把这种不可思议的天体叫作“黑洞”。\n",14); sstr(100000,"请按任意键继续。",8); char nt; nt = getch(); printf("\r \r"); sstr(19876543,"在数学中,也有着一种神秘而有趣的“数字黑洞”现象。\n所谓数字黑洞,就是无论如何设定初始数值,在某种黑洞规则下,经过反复选代后,最终都会得到固定的一个数值,或者陷入一组数的循环之中,就像宇宙中的黑洞吞它周围的物质一样。\n",14); sstr(100001,"请按任意键继续。",8); nt = getch(); printf("\r \r"); sstr(5000000,"\n这里给出了两个数字黑洞的定义:\n",8); sstr(22000000,doc[3],6); cout<<endl; sstr(22000000,doc[4],6); cout<<endl; cout<<endl<<endl; sstr(text1,doc[5],14); cout<<endl; sstr(100001,"请按任意键继续。",8); nt = getch(); printf("\r \r"); sstr(10000001,"\n拓展:其他数字黑洞:\n1.西西弗斯黑洞\n2.卡布雷西而黑洞\n3.数字黑洞1和4\n",6); } else if(a==3){ printf("\nUpdate:\n"); printf("2024-03-23 V1.0 编写初始框架\n"); printf("2024-03-24 V1.2 完善“冰雹猜想”部分\n"); printf("2024-03-24 V1.3 修复漏洞,添加黑洞定义部分\n"); printf("2024-03-25 V1.3.1 修复漏洞,添加Update\n"); printf("2024-03-26 V1.4 修复换行漏洞,完善圣经数部分\n"); printf("2024-05-26 V1.4.1 修复输出漏洞(圣经数部分),添加少数注释\n"); printf("2024-08-04 V1.4.2 修复部分判断漏洞\n"); } else{ break; } } /* 0 = 黑色 8 = 灰色 1 = 蓝色 9 = 淡蓝色 2 = 绿色 10 = 淡绿色 3 = 浅绿色 11 = 淡浅绿色 4 = 红色 12 = 淡红色 5 = 紫色 13 = 淡紫色 6 = 黄色 14 = 淡黄色 7 = 白色 15 = 亮白色 */ cout<<"\nBye!"<<endl; return 0; }
    2 回复
  • 2024-08-25 12:05
    我也有一个
    1 回复
  • 2024-08-22 11:49
    #include <bits/stdc++.h> #include <windows.h> #include <stdlib.h> using namespace std; string a[50]; int cn ; void _start() { cout << "-------------生存游戏--------------" << endl; Sleep(1000); cout << " " << "作者:Leng" << endl; cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(300); cout << "版"; Sleep(300); cout << "本"; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1" ; Sleep(300); cout << ' ' << "-"; cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; cout << endl; Sleep(980); cout << "1.1.1版本升级点: \n"; Sleep(800); /* cout << "1.修复了一些乱码及a[24]、a[36]的文字问题" << endl; Sleep(510); cout << "2.新增help功能 \n"; Sleep(500); */ cout << "1.适用于c++5.12以上的编译器(1.1.0仅适用于c++5.12)\n"; Sleep(510); cout << "2.新增中途退出功能" << endl; Sleep(1010); cn = 5; cout << "注意事项:\n1.如果拿不定主意,可以输入数字5。求助次数为5。\n输入6,结束游戏" << endl; Sleep(500); cout << "输入任意字符开始游戏" << endl; int as; cin >> as; } int _end() { cout << "是否结束游戏?\n1.是\n2.否\n"; int r; cin >> r; return r; } void _help(int s) { if (cn == 0) { cout << "提示次数为0!"; Sleep(880); cout << "\033c"; system("cls"); cout << a[s] << endl; return; } int u = cn; if (s == 2) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 7) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 8) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 9) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 13) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 14) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 15) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 16) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 17) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 18) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 20) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 21) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 23) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 27) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 28) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 29) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 30) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 32) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 36) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 37) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 40) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } //Sleep(2000); if (cn == u) { cout << "输入任意字符继续"; Sleep(1800); } system("cls"); cout << a[s] << endl; return; /* if(s==2){ cout<<"May be 2"<<endl; cn--; cout<<"剩余提示次数:"<<cn<<endl; sleep(500); cout << "\033c"; } */ } /* 这是一个c++小游戏。(程序自创,文章内容参考《牛津英汉双语读物·入门级·上<生存游戏>》) 1.1.0 版本升级点: 1.修复了一些乱码及a[24]、a[36]的文字问题 2.新增help功能 */ int main() { a[1] = "你名叫xx,正驾驶一架小型飞机飞越落基山脉。突然,发动机发出了奇怪的响声,飞机朝着一座山坠去。你的无线电失灵了,没有人知道你所在的位置。\n输入0继续"; a[2] = "你穿着外套,拿着威士忌和地图,过了大约20分钟。积雪很厚,你感到很冷。\n1你回到飞机上,拿了一些其他物品。\n2为了暖和一点,你喝了威士忌。"; a[3] = "你回去睡觉,再也没听到直升机的声响。第2天,你继续沿着河边走。"; a[4] = "你原路返回,出了隧道,走进乱石丛生的山谷。"; a[5] = "你吃了果子。虽然味道不好,但是你太饿了,还是吃了不少。你带了些果子在身上,过后可以吃。"; a[6] = "你穿着外套,拿着香蕉和打火机,走了大约20分钟。积雪很厚,你感到很冷。你回到树林,生起火堆。"; a[7] = "又到了晚上,但因为之前吃了鱼,你并没有觉得饿。你在树下搭了一座帐棚。早上醒来后,你听到了一阵响声。\n你跑出帐棚往天上看,发现有一架直升机。虽然你看得直升机,但因为树枝的遮挡,飞机上的人看不到你。飞机就要飞走了。\n1你追着直升机跑。\n2你回棚里睡觉。\n3你生起了火堆。 \n4你冲着直升机一边大声呼喊,一边挥动双臂。"; a[8] = "你顺着山谷走出很远,夜晚将要来临了。你在树林里生起了火,吃了香蕉。第2天早上,你感到很饿,必须找些东西吃。你在雪地上发现了动物的脚印,也许你可以猎杀这只动物作食物。\n1你沿着脚印追踪走去。\n2你很害怕大型动物。或许这只动物很危险,于是你向山下走去。"; a[9] = "你带着香蕉、打火机和地图走了几分钟,感到非常寒冷。\n1你生起火堆?。\n2你回到飞机上去取威士忌。"; a[10] = "时间到了下午。你开始觉得很不舒服。也许那些果子有毒。你走不动了,坐在雪地上,觉得越来越冷。"; a[11] = "你向右转,飞机撞到了树上。"; a[12] = "你横穿湖面,在冰上走。几分钟后,冰裂开了,你掉进了冰窟窿。"; a[13] = "你带着威士忌、打火机和香蕉走了几分钟,感到非常寒冷。\n1你喝了威士忌。\n2你回到飞机上,放下了威士忌,带上了外套。"; a[14] = "河面上结了冰,但中间有洞隙。你看到河里有鱼。也许你可以抓一条鱼吃。\n1你试着从冰隙间捉几条鱼。\n2在河边捉鱼很危险。你继续往前走。"; a[15] = "你向左转,想在雪地上着陆。飞机落在雪中,停了下来。你虽然安全了,但却身处山顶,天异常寒冷。天黑了下来。 \n1你待在飞机上。\n2你向山下走去。"; a[16] = "山谷的岩石很难攀爬,几分钟之后你就疲惫不堪了。\n1你继续沿着山谷走。\n2你往回走,出了山谷,进了隧道。"; a[17] = "你穿过树林向山下走,感觉饥肠辘辘。你看到有一棵树上结着没见过的果子。\n1你吃了果子。\n2你不吃果子。"; a[18] = "你小心地走上湖面。走了几百米后,脚下的冰开始晃动。\n1你继续在湖面上穿行。\n2你退了回去,然后绕着湖走。"; a[19] = "你重新生起火堆。大概两个小时后,你又听到了直升机的声响。这一次,飞机看到了烟,停在了你旁边的雪地上。这下你安全了。你乘飞机前往医院,可以在那里吃饭和休息。"; a[20] = "你极快地向林中坠去,但你可以让飞机向左转弯或向右转弯。右边是一些树,左边是厚厚的积雪。\n1你向右转。\n2你向左转。"; a[21] = "你继续沿着河走,感觉非常饥饿,必须找东西吃。树上有果子,河中有鱼。\n1你尝试着抓一条鱼。\n2你吃了一些果子。"; a[22] = "绳子断了。"; a[23] = "你继续在雪中跋涉。没有吃的东西,但你可以生火,还可以喝雪水。突然,你发现前面有一个结了冰的湖。\n1你横穿湖面。这样会快一些,你必须找点吃的东西。\n2你绕着湖?。你去寻找条河。"; a[24] = "你待在飞机上,但感到异常寒冷。你真的不想活了吗?"; a[25] = "你在飞机上待了四天,什么也看不到,什么也听不到。你必须下山。"; a[26] = "经过几十分钟的努力,你终于捉到了一条鱼。你又多捉了几条。你感到很冷,于是生起了火堆,烤了几条鱼吃。味道好极了。"; a[27] = "你朝山下走去。几分钟后看到前面有一条隧道。你的左侧还有一个布满岩石的山谷。\n1你沿着山谷走去。\n2你走进隧道。"; a[28] = "你绕着湖走。走约大了五公后,你发现了一条河。河水从湖中流出,向远处流去。\n1你继续绕着湖走。\n2你沿着河走去。"; a[29] = "你想下山。飞机上有一些东西,你可以随身带上几样。你会带哪些呢?\n1外套、威士忌和地图。\n2外套、香蕉和打火机。\n3香蕉、打火机和地图。\n4威士忌、打火机和香蕉。"; a[30] = "一整天,烟不停地升上天空,但是直升机没有出现。你等了一整天。第2天,你一大早就醒来了。\n1你重新生起火堆。\n2你沿着河走去。"; a[31] = "你追着直升机跑,但它飞得很快。你不得不往山上爬,在厚厚的雪中跋涉了一整天,但再也没找到那架直升机。"; a[32] = "你待在飞机附近。坐在一边,看着天,就这样过了两天。什么也没有发生。\n1你待在飞机附近。\n2你试着向山下走去。"; a[33] = "你走进隧道。漆黑一片。你看到有一盏灯,便点上了。"; a[34] = "为了暖和一点儿,你喝了威士忌,但并没有觉得暖和起来。你只是感到很累,筋疲力尽。"; a[35] = "你生起火堆,火堆冒出很多烟。你看着冲天的烟柱。"; a[36] = "你整晚都坐在树林里的火堆前。虽然天很冷,但火烧得很旺,你可以稍微睡一会。你需要想想天亮以后你可以做些什么。\n1你待在飞机附近。\n2你朝山下走去。"; a[37] = "你冲着直升机一边大声呼喊,一边挥动双臂。直升机掉头往回飞了一会,然后向天上飞去。\n1你追着直升机跑。\n2你回去睡觉。\n3你生起火堆。"; a[38] = "你绕着湖走了1整圈,筋疲力尽,没有找到任何事物。你只能沿着河走。"; a[39] = "你沿着脚印在树林中走了很远。脚印延伸到1棵大树的后面。你朝树后看去,看到了一只大熊。这肯定不是能吃的。你悄悄地离开了。"; a[40] = "你向洞的深处走,走了约5分钟,发现地上有一个很大的洞。1条很旧的绳向下直延伸到洞中。\n1你顺着绳子下到洞中。\n2你退回到隧道口。"; cn = 5; _start(); int s = 1; //cout << "\033c"; system("cls"); while (1) { int b, c = 0, d = 0, e; if (s == 1) { cout << a[1] << endl; s = 20; cin >> b; //cout << "\033c"; } else if (s == 2) { cout << a[2] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 29; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 3) { cout << a[3] << endl; cin >> b; s = 21; //cout << "\033c"; } else if (s == 4) { cout << a[4] << endl; cin >> b; s = 16; //cout << "\033c"; //system("cls"); } else if (s == 5) { cout << a[5] << endl; s = 10; cin >> b; //cout << "\033c"; } else if (s == 6) { cout << a[6] << endl; s = 36; cin >> b; //cout << "\033c"; } else if (s == 7) { cout << a[7] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } if (b == 4) { s = 37; } //cout << "\033c"; } else if (s == 8) { cout << a[8] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 39; } if (b == 2) { s = 17; } //cout << "\033c"; } else if (s == 9) { cout << a[9] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 36; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 10) { cout << a[10] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 11) { cout << a[s] << endl; cin >> b; //cout << "\033c"; s = 1; } else if (s == 12) { cout << a[12] << endl; cin >> b; //cout << "\033c"; } else if (s == 13) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 34; } if (b == 2) { s = 6; } //cout << "\033c"; } else if (s == 14) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 15) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 24; } if (b == 2) { s = 29; } //cout << "\033c"; } else if (s == 16) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 8; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 17) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 5; } if (b == 2) { s = 23; } //cout << "\033c"; } else if (s == 18) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 12; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 19) { cout << a[s] << endl; cout << "GAME OVER!"; break; //cout << "\033c"; } else if (s == 20) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 11; } if (b == 2) { s = 15; } //cout << "\033c"; } else if (s == 21) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 5; } //cout << "\033c"; } else if (s == 22) { cout << a[s] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 23) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 18; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 24) { cout << a[s] << endl; cin >> b; s = 29; //cout << "\033c"; } else if (s == 25) { cout << a[s] << endl; cin >> b; s = 27; //cout << "\033c"; } else if (s == 26) { cout << a[s] << endl; cin >> b; s = 7; //cout << "\033c"; } else if (s == 27) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 16; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 28) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 38; } if (b == 2) { s = 14; } //cout << "\033c"; } else if (s == 29) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 2; } if (b == 2) { s = 6; } if (b == 3) { s = 9; } if (b == 4) { s = 13; } //cout << "\033c"; } else if (s == 30) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 19; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 31) { cout << a[s] << endl; cin >> b; s = 23; //cout << "\033c"; } else if (s == 32) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 25; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 33) { cout << a[s] << endl; cin >> b; s = 40; //cout << "\033c"; } else if (s == 34) { cout << a[s] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 35) { cout << a[s] << endl; cin >> b; s = 30; //cout << "\033c"; } else if (s == 36) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 32; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 37) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } //cout << "\033c"; } else if (s == 38) { cout << a[s] << endl; cin >> b; s = 14; //cout << "\033c"; } else if (s == 39) { cout << a[s] << endl; cin >> b; s = 17; //cout << "\033c"; } else if (s == 40) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 22; } if (b == 2) { s = 4; } //cout << "\033c"; } if (b == 6) { if (_end() == 1) { cout << "退出中......"; Sleep(500); system("cls"); break; } } system("cls"); /* if(s==){ cout<<a[s]<<endl; cin>>b; cout << "\033c"; } */ } //cout << "\033c"; //cout << "\033c"; }
    0 回复
  • 2024-08-22 11:20
    //适用于c++5.12以上编译器 #include <bits/stdc++.h> #include <windows.h> #include <stdlib.h> using namespace std; string a[50]; int cn ; void _help(int s) { if (cn == 0) { cout << "提示次数为0!"; Sleep(880); cout << "\033c"; system("cls"); cout << a[s] << endl; return; } if (s == 2) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 7) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 8) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 9) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 13) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 14) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 15) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 16) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 17) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 18) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 20) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 21) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 23) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 27) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 28) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 29) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 30) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 32) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 36) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 37) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } if (s == 40) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); //cout << "\033c"; } //Sleep(2000); system("cls"); cout << a[s] << endl; return; /* if(s==2){ cout<<"May be 2"<<endl; cn--; cout<<"剩余提示次数:"<<cn<<endl; sleep(500); cout << "\033c"; } */ } /* 这是一个c++小游戏。(程序自创,文章内容参考《牛津英汉双语读物·入门级·上<生存游戏>》) 1.1.0 版本升级点: 1.修复了一些乱码及a[24]、a[36]的文字问题 2.新增help功能 */ int main() { a[1] = "你名叫xx,正驾驶一架小型飞机飞越落基山脉。突然,发动机发出了奇怪的响声,飞机朝着一座山坠去。你的无线电失灵了,没有人知道你所在的位置。\n输入0继续"; a[2] = "你穿着外套,拿着威士忌和地图,过了大约20分钟。积雪很厚,你感到很冷。\n1你回到飞机上,拿了一些其他物品。\n2为了暖和一点,你喝了威士忌。"; a[3] = "你回去睡觉,再也没听到直升机的声响。第2天,你继续沿着河边走。"; a[4] = "你原路返回,出了隧道,走进乱石丛生的山谷。"; a[5] = "你吃了果子。虽然味道不好,但是你太饿了,还是吃了不少。你带了些果子在身上,过后可以吃。"; a[6] = "你穿着外套,拿着香蕉和打火机,走了大约20分钟。积雪很厚,你感到很冷。你回到树林,生起火堆。"; a[7] = "又到了晚上,但因为之前吃了鱼,你并没有觉得饿。你在树下搭了一座帐棚。早上醒来后,你听到了一阵响声。\n你跑出帐棚往天上看,发现有一架直升机。虽然你看得直升机,但因为树枝的遮挡,飞机上的人看不到你。飞机就要飞走了。\n1你追着直升机跑。\n2你回棚里睡觉。\n3你生起了火堆。 \n4你冲着直升机一边大声呼喊,一边挥动双臂。"; a[8] = "你顺着山谷走出很远,夜晚将要来临了。你在树林里生起了火,吃了香蕉。第2天早上,你感到很饿,必须找些东西吃。你在雪地上发现了动物的脚印,也许你可以猎杀这只动物作食物。\n1你沿着脚印追踪走去。\n2你很害怕大型动物。或许这只动物很危险,于是你向山下走去。"; a[9] = "你带着香蕉、打火机和地图走了几分钟,感到非常寒冷。\n1你生起火堆?。\n2你回到飞机上去取威士忌。"; a[10] = "时间到了下午。你开始觉得很不舒服。也许那些果子有毒。你走不动了,坐在雪地上,觉得越来越冷。"; a[11] = "你向右转,飞机撞到了树上。"; a[12] = "你横穿湖面,在冰上走。几分钟后,冰裂开了,你掉进了冰窟窿。"; a[13] = "你带着威士忌、打火机和香蕉走了几分钟,感到非常寒冷。\n1你喝了威士忌。\n2你回到飞机上,放下了威士忌,带上了外套。"; a[14] = "河面上结了冰,但中间有洞隙。你看到河里有鱼。也许你可以抓一条鱼吃。\n1你试着从冰隙间捉几条鱼。\n2在河边捉鱼很危险。你继续往前走。"; a[15] = "你向左转,想在雪地上着陆。飞机落在雪中,停了下来。你虽然安全了,但却身处山顶,天异常寒冷。天黑了下来。 \n1你待在飞机上。\n2你向山下走去。"; a[16] = "山谷的岩石很难攀爬,几分钟之后你就疲惫不堪了。\n1你继续沿着山谷走。\n2你往回走,出了山谷,进了隧道。"; a[17] = "你穿过树林向山下走,感觉饥肠辘辘。你看到有一棵树上结着没见过的果子。\n1你吃了果子。\n2你不吃果子。"; a[18] = "你小心地走上湖面。走了几百米后,脚下的冰开始晃动。\n1你继续在湖面上穿行。\n2你退了回去,然后绕着湖走。"; a[19] = "你重新生起火堆。大概两个小时后,你又听到了直升机的声响。这一次,飞机看到了烟,停在了你旁边的雪地上。这下你安全了。你乘飞机前往医院,可以在那里吃饭和休息。"; a[20] = "你极快地向林中坠去,但你可以让飞机向左转弯或向右转弯。右边是一些树,左边是厚厚的积雪。\n1你向右转。\n2你向左转。"; a[21] = "你继续沿着河走,感觉非常饥饿,必须找东西吃。树上有果子,河中有鱼。\n1你尝试着抓一条鱼。\n2你吃了一些果子。"; a[22] = "绳子断了。"; a[23] = "你继续在雪中跋涉。没有吃的东西,但你可以生火,还可以喝雪水。突然,你发现前面有一个结了冰的湖。\n1你横穿湖面。这样会快一些,你必须找点吃的东西。\n2你绕着湖?。你去寻找条河。"; a[24] = "你待在飞机上,但感到异常寒冷。你真的不想活了吗?"; a[25] = "你在飞机上待了四天,什么也看不到,什么也听不到。你必须下山。"; a[26] = "经过几十分钟的努力,你终于捉到了一条鱼。你又多捉了几条。你感到很冷,于是生起了火堆,烤了几条鱼吃。味道好极了。"; a[27] = "你朝山下走去。几分钟后看到前面有一条隧道。你的左侧还有一个布满岩石的山谷。\n1你沿着山谷走去。\n2你走进隧道。"; a[28] = "你绕着湖走。走约大了五公后,你发现了一条河。河水从湖中流出,向远处流去。\n1你继续绕着湖走。\n2你沿着河走去。"; a[29] = "你想下山。飞机上有一些东西,你可以随身带上几样。你会带哪些呢?\n1外套、威士忌和地图。\n2外套、香蕉和打火机。\n3香蕉、打火机和地图。\n4威士忌、打火机和香蕉。"; a[30] = "一整天,烟不停地升上天空,但是直升机没有出现。你等了一整天。第2天,你一大早就醒来了。\n1你重新生起火堆。\n2你沿着河走去。"; a[31] = "你追着直升机跑,但它飞得很快。你不得不往山上爬,在厚厚的雪中跋涉了一整天,但再也没找到那架直升机。"; a[32] = "你待在飞机附近。坐在一边,看着天,就这样过了两天。什么也没有发生。\n1你待在飞机附近。\n2你试着向山下走去。"; a[33] = "你走进隧道。漆黑一片。你看到有一盏灯,便点上了。"; a[34] = "为了暖和一点儿,你喝了威士忌,但并没有觉得暖和起来。你只是感到很累,筋疲力尽。"; a[35] = "你生起火堆,火堆冒出很多烟。你看着冲天的烟柱。"; a[36] = "你整晚都坐在树林里的火堆前。虽然天很冷,但火烧得很旺,你可以稍微睡一会。你需要想想天亮以后你可以做些什么。\n1你待在飞机附近。\n2你朝山下走去。"; a[37] = "你冲着直升机一边大声呼喊,一边挥动双臂。直升机掉头往回飞了一会,然后向天上飞去。\n1你追着直升机跑。\n2你回去睡觉。\n3你生起火堆。"; a[38] = "你绕着湖走了1整圈,筋疲力尽,没有找到任何事物。你只能沿着河走。"; a[39] = "你沿着脚印在树林中走了很远。脚印延伸到1棵大树的后面。你朝树后看去,看到了一只大熊。这肯定不是能吃的。你悄悄地离开了。"; a[40] = "你向洞的深处走,走了约5分钟,发现地上有一个很大的洞。1条很旧的绳向下直延伸到洞中。\n1你顺着绳子下到洞中。\n2你退回到隧道口。"; cn = 5; cout << "-------------生存游戏--------------" << endl; Sleep(1000); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(300); cout << "版"; Sleep(300); cout << "本"; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1" ; Sleep(300); cout << ' ' << "-"; cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; cout << endl; Sleep(980); cout << "1.1.1版本升级点: \n"; Sleep(800); /* cout << "1.修复了一些乱码及a[24]、a[36]的文字问题" << endl; Sleep(510); cout << "2.新增help功能 \n"; Sleep(500); */ cout << "1.适用于c++5.12以上的编译器(1.1.0仅适用于c++5.12)\n"; Sleep(1010); cn = 5; cout << "注意事项:如果拿不定主意,可以输入数字5。求助次数为5。" << endl; Sleep(500); cout << "输入任意字符开始游戏" << endl; int as; cin >> as; int s = 1; //cout << "\033c"; system("cls"); while (1) { int b, c = 0, d = 0, e; if (s == 1) { cout << a[1] << endl; s = 20; cin >> b; //cout << "\033c"; } else if (s == 2) { cout << a[2] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 29; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 3) { cout << a[3] << endl; cin >> b; s = 21; //cout << "\033c"; } else if (s == 4) { cout << a[4] << endl; cin >> b; s = 16; //cout << "\033c"; //system("cls"); } else if (s == 5) { cout << a[5] << endl; s = 10; cin >> b; //cout << "\033c"; } else if (s == 6) { cout << a[6] << endl; s = 36; cin >> b; //cout << "\033c"; } else if (s == 7) { cout << a[7] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } if (b == 4) { s = 37; } //cout << "\033c"; } else if (s == 8) { cout << a[8] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 39; } if (b == 2) { s = 17; } //cout << "\033c"; } else if (s == 9) { cout << a[9] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 36; } if (b == 2) { s = 34; } //cout << "\033c"; } else if (s == 10) { cout << a[10] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 11) { cout << a[s] << endl; cin >> b; //cout << "\033c"; s = 1; } else if (s == 12) { cout << a[12] << endl; cin >> b; //cout << "\033c"; } else if (s == 13) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 34; } if (b == 2) { s = 6; } //cout << "\033c"; } else if (s == 14) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 15) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 24; } if (b == 2) { s = 29; } //cout << "\033c"; } else if (s == 16) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 8; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 17) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 5; } if (b == 2) { s = 23; } //cout << "\033c"; } else if (s == 18) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 12; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 19) { cout << a[s] << endl; cout << "GAME OVER!"; break; //cout << "\033c"; } else if (s == 20) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 11; } if (b == 2) { s = 15; } //cout << "\033c"; } else if (s == 21) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 5; } //cout << "\033c"; } else if (s == 22) { cout << a[s] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 23) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 18; } if (b == 2) { s = 28; } //cout << "\033c"; } else if (s == 24) { cout << a[s] << endl; cin >> b; s = 29; //cout << "\033c"; } else if (s == 25) { cout << a[s] << endl; cin >> b; s = 27; //cout << "\033c"; } else if (s == 26) { cout << a[s] << endl; cin >> b; s = 7; //cout << "\033c"; } else if (s == 27) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 16; } if (b == 2) { s = 33; } //cout << "\033c"; } else if (s == 28) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 38; } if (b == 2) { s = 14; } //cout << "\033c"; } else if (s == 29) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 2; } if (b == 2) { s = 6; } if (b == 3) { s = 9; } if (b == 4) { s = 13; } //cout << "\033c"; } else if (s == 30) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 19; } if (b == 2) { s = 21; } //cout << "\033c"; } else if (s == 31) { cout << a[s] << endl; cin >> b; s = 23; //cout << "\033c"; } else if (s == 32) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 25; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 33) { cout << a[s] << endl; cin >> b; s = 40; //cout << "\033c"; } else if (s == 34) { cout << a[s] << endl; cin >> b; s = 1; //cout << "\033c"; } else if (s == 35) { cout << a[s] << endl; cin >> b; s = 30; //cout << "\033c"; } else if (s == 36) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 32; } if (b == 2) { s = 27; } //cout << "\033c"; } else if (s == 37) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } //cout << "\033c"; } else if (s == 38) { cout << a[s] << endl; cin >> b; s = 14; //cout << "\033c"; } else if (s == 39) { cout << a[s] << endl; cin >> b; s = 17; //cout << "\033c"; } else if (s == 40) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 22; } if (b == 2) { s = 4; } //cout << "\033c"; } system("cls"); /* if(s==){ cout<<a[s]<<endl; cin>>b; cout << "\033c"; } */ } //cout << "\033c"; //cout << "\033c"; }
    0 回复
  • 2024-08-22 10:26
    #include <bits/stdc++.h> #include <windows.h> using namespace std; string a[50]; int cn ; void _help(int s) { if (cn == 0) { cout << "提示次数为0!"; Sleep(880); cout << "\033c"; system("cls"); cout << a[s] << endl; return; } if (s == 2) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 7) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 8) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 9) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 13) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 14) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 15) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 16) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 17) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 18) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 20) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 21) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 23) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 27) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 28) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 29) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 30) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 32) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 36) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 37) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } if (s == 40) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; //Sleep(3000); cout << "\033c"; } Sleep(2000); cout << a[s] << endl; return; /* if(s==2){ cout<<"May be 2"<<endl; cn--; cout<<"剩余提示次数:"<<cn<<endl; sleep(500); cout << "\033c"; } */ } /* 这是一个c++小游戏。(程序自创,文章内容参考《牛津英汉双语读物·入门级·上<生存游戏>》) 1.1.0 版本升级点: 1.修复了一些乱码及a[24]、a[36]的文字问题 2.新增help功能 */ int main() { a[1] = "你名叫xx,正驾驶一架小型飞机飞越落基山脉。突然,发动机发出了奇怪的响声,飞机朝着一座山坠去。你的无线电失灵了,没有人知道你所在的位置。\n输入0继续"; a[2] = "你穿着外套,拿着威士忌和地图,过了大约20分钟。积雪很厚,你感到很冷。\n1你回到飞机上,拿了一些其他物品。\n2为了暖和一点,你喝了威士忌。"; a[3] = "你回去睡觉,再也没听到直升机的声响。第2天,你继续沿着河边走。"; a[4] = "你原路返回,出了隧道,走进乱石丛生的山谷。"; a[5] = "你吃了果子。虽然味道不好,但是你太饿了,还是吃了不少。你带了些果子在身上,过后可以吃。"; a[6] = "你穿着外套,拿着香蕉和打火机,走了大约20分钟。积雪很厚,你感到很冷。你回到树林,生起火堆。"; a[7] = "又到了晚上,但因为之前吃了鱼,你并没有觉得饿。你在树下搭了一座帐棚。早上醒来后,你听到了一阵响声。\n你跑出帐棚往天上看,发现有一架直升机。虽然你看得直升机,但因为树枝的遮挡,飞机上的人看不到你。飞机就要飞走了。\n1你追着直升机跑。\n2你回棚里睡觉。\n3你生起了火堆。 \n4你冲着直升机一边大声呼喊,一边挥动双臂。"; a[8] = "你顺着山谷走出很远,夜晚将要来临了。你在树林里生起了火,吃了香蕉。第2天早上,你感到很饿,必须找些东西吃。你在雪地上发现了动物的脚印,也许你可以猎杀这只动物作食物。\n1你沿着脚印追踪走去。\n2你很害怕大型动物。或许这只动物很危险,于是你向山下走去。"; a[9] = "你带着香蕉、打火机和地图走了几分钟,感到非常寒冷。\n1你生起火堆?。\n2你回到飞机上去取威士忌。"; a[10] = "时间到了下午。你开始觉得很不舒服。也许那些果子有毒。你走不动了,坐在雪地上,觉得越来越冷。"; a[11] = "你向右转,飞机撞到了树上。"; a[12] = "你横穿湖面,在冰上走。几分钟后,冰裂开了,你掉进了冰窟窿。"; a[13] = "你带着威士忌、打火机和香蕉走了几分钟,感到非常寒冷。\n1你喝了威士忌。\n2你回到飞机上,放下了威士忌,带上了外套。"; a[14] = "河面上结了冰,但中间有洞隙。你看到河里有鱼。也许你可以抓一条鱼吃。\n1你试着从冰隙间捉几条鱼。\n2在河边捉鱼很危险。你继续往前走。"; a[15] = "你向左转,想在雪地上着陆。飞机落在雪中,停了下来。你虽然安全了,但却身处山顶,天异常寒冷。天黑了下来。 \n1你待在飞机上。\n2你向山下走去。"; a[16] = "山谷的岩石很难攀爬,几分钟之后你就疲惫不堪了。\n1你继续沿着山谷走。\n2你往回走,出了山谷,进了隧道。"; a[17] = "你穿过树林向山下走,感觉饥肠辘辘。你看到有一棵树上结着没见过的果子。\n1你吃了果子。\n2你不吃果子。"; a[18] = "你小心地走上湖面。走了几百米后,脚下的冰开始晃动。\n1你继续在湖面上穿行。\n2你退了回去,然后绕着湖走。"; a[19] = "你重新生起火堆。大概两个小时后,你又听到了直升机的声响。这一次,飞机看到了烟,停在了你旁边的雪地上。这下你安全了。你乘飞机前往医院,可以在那里吃饭和休息。"; a[20] = "你极快地向林中坠去,但你可以让飞机向左转弯或向右转弯。右边是一些树,左边是厚厚的积雪。\n1你向右转。\n2你向左转。"; a[21] = "你继续沿着河走,感觉非常饥饿,必须找东西吃。树上有果子,河中有鱼。\n1你尝试着抓一条鱼。\n2你吃了一些果子。"; a[22] = "绳子断了。"; a[23] = "你继续在雪中跋涉。没有吃的东西,但你可以生火,还可以喝雪水。突然,你发现前面有一个结了冰的湖。\n1你横穿湖面。这样会快一些,你必须找点吃的东西。\n2你绕着湖?。你去寻找条河。"; a[24] = "你待在飞机上,但感到异常寒冷。你真的不想活了吗?"; a[25] = "你在飞机上待了四天,什么也看不到,什么也听不到。你必须下山。"; a[26] = "经过几十分钟的努力,你终于捉到了一条鱼。你又多捉了几条。你感到很冷,于是生起了火堆,烤了几条鱼吃。味道好极了。"; a[27] = "你朝山下走去。几分钟后看到前面有一条隧道。你的左侧还有一个布满岩石的山谷。\n1你沿着山谷走去。\n2你走进隧道。"; a[28] = "你绕着湖走。走约大了五公后,你发现了一条河。河水从湖中流出,向远处流去。\n1你继续绕着湖走。\n2你沿着河走去。"; a[29] = "你想下山。飞机上有一些东西,你可以随身带上几样。你会带哪些呢?\n1外套、威士忌和地图。\n2外套、香蕉和打火机。\n3香蕉、打火机和地图。\n4威士忌、打火机和香蕉。"; a[30] = "一整天,烟不停地升上天空,但是直升机没有出现。你等了一整天。第2天,你一大早就醒来了。\n1你重新生起火堆。\n2你沿着河走去。"; a[31] = "你追着直升机跑,但它飞得很快。你不得不往山上爬,在厚厚的雪中跋涉了一整天,但再也没找到那架直升机。"; a[32] = "你待在飞机附近。坐在一边,看着天,就这样过了两天。什么也没有发生。\n1你待在飞机附近。\n2你试着向山下走去。"; a[33] = "你走进隧道。漆黑一片。你看到有一盏灯,便点上了。"; a[34] = "为了暖和一点儿,你喝了威士忌,但并没有觉得暖和起来。你只是感到很累,筋疲力尽。"; a[35] = "你生起火堆,火堆冒出很多烟。你看着冲天的烟柱。"; a[36] = "你整晚都坐在树林里的火堆前。虽然天很冷,但火烧得很旺,你可以稍微睡一会。你需要想想天亮以后你可以做些什么。\n1你待在飞机附近。\n2你朝山下走去。"; a[37] = "你冲着直升机一边大声呼喊,一边挥动双臂。直升机掉头往回飞了一会,然后向天上飞去。\n1你追着直升机跑。\n2你回去睡觉。\n3你生起火堆。"; a[38] = "你绕着湖走了1整圈,筋疲力尽,没有找到任何事物。你只能沿着河走。"; a[39] = "你沿着脚印在树林中走了很远。脚印延伸到1棵大树的后面。你朝树后看去,看到了一只大熊。这肯定不是能吃的。你悄悄地离开了。"; a[40] = "你向洞的深处走,走了约5分钟,发现地上有一个很大的洞。1条很旧的绳向下直延伸到洞中。\n1你顺着绳子下到洞中。\n2你退回到隧道口。"; cout << "-------------生存游戏--------------" << endl; Sleep(1000); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(300); cout << "版"; Sleep(300); cout << "本"; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "0" ; Sleep(300); cout << ' ' << "-"; cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; Sleep(100); cout << "-"; cout << endl; Sleep(980); cout << "1.1.0版本升级点: \n"; Sleep(800); cout << "1.修复了一些乱码及a[24]、a[36]的文字问题" << endl; Sleep(510); cout << "2.新增help功能 \n"; Sleep(1010); cn = 5; cout << "注意事项:如果拿不定主意,可以输入数字5。求助次数为5。" << endl; Sleep(500); cout << "输入任意字符开始游戏" << endl; int as; cin >> as; int s = 1; //cout << "\033c"; system("cls"); while (1) { int b, c = 0, d = 0, e; if (s == 1) { cout << a[1] << endl; s = 20; cin >> b; cout << "\033c"; } if (s == 2) { cout << a[2] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 29; } if (b == 2) { s = 34; } cout << "\033c"; } if (s == 3) { cout << a[3] << endl; cin >> b; s = 21; cout << "\033c"; } if (s == 4) { cout << a[4] << endl; cin >> b; s = 16; cout << "\033c"; system("cls"); } if (s == 5) { cout << a[5] << endl; s = 10; cin >> b; cout << "\033c"; } if (s == 6) { cout << a[6] << endl; s = 36; cin >> b; cout << "\033c"; } if (s == 7) { cout << a[7] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } if (b == 4) { s = 37; } cout << "\033c"; } if (s == 8) { cout << a[8] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 39; } if (b == 2) { s = 17; } cout << "\033c"; } if (s == 9) { cout << a[9] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 36; } if (b == 2) { s = 34; } cout << "\033c"; } if (s == 10) { cout << a[10] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 11) { cout << a[s] << endl; cin >> b; cout << "\033c"; s = 1; } if (s == 12) { cout << a[12] << endl; cin >> b; cout << "\033c"; } if (s == 13) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 34; } if (b == 2) { s = 6; } cout << "\033c"; } if (s == 14) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 21; } cout << "\033c"; } if (s == 15) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 24; } if (b == 2) { s = 29; } cout << "\033c"; } if (s == 16) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 8; } if (b == 2) { s = 33; } cout << "\033c"; } if (s == 17) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 5; } if (b == 2) { s = 23; } cout << "\033c"; } if (s == 18) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 12; } if (b == 2) { s = 28; } cout << "\033c"; } if (s == 19) { cout << a[s] << endl; cout << "GAME OVER!"; break; cout << "\033c"; } if (s == 20) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 11; } if (b == 2) { s = 15; } cout << "\033c"; } if (s == 21) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 5; } cout << "\033c"; } if (s == 22) { cout << a[s] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 23) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 18; } if (b == 2) { s = 28; } cout << "\033c"; } if (s == 24) { cout << a[s] << endl; cin >> b; s = 29; cout << "\033c"; } if (s == 25) { cout << a[s] << endl; cin >> b; s = 27; cout << "\033c"; } if (s == 26) { cout << a[s] << endl; cin >> b; s = 7; cout << "\033c"; } if (s == 27) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 16; } if (b == 2) { s = 33; } cout << "\033c"; } if (s == 28) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 38; } if (b == 2) { s = 14; } cout << "\033c"; } if (s == 29) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 2; } if (b == 2) { s = 6; } if (b == 3) { s = 9; } if (b == 4) { s = 13; } cout << "\033c"; } if (s == 30) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 19; } if (b == 2) { s = 21; } cout << "\033c"; } if (s == 31) { cout << a[s] << endl; cin >> b; s = 23; cout << "\033c"; } if (s == 32) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 25; } if (b == 2) { s = 27; } cout << "\033c"; } if (s == 33) { cout << a[s] << endl; cin >> b; s = 40; cout << "\033c"; } if (s == 34) { cout << a[s] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 35) { cout << a[s] << endl; cin >> b; s = 30; cout << "\033c"; } if (s == 36) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 32; } if (b == 2) { s = 27; } cout << "\033c"; } if (s == 37) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } cout << "\033c"; } if (s == 38) { cout << a[s] << endl; cin >> b; s = 14; cout << "\033c"; } if (s == 39) { cout << a[s] << endl; cin >> b; s = 17; cout << "\033c"; } if (s == 40) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 22; } if (b == 2) { s = 4; } cout << "\033c"; } system("cls"); /* if(s==){ cout<<a[s]<<endl; cin>>b; cout << "\033c"; } */ } //cout << "\033c"; //cout << "\033c"; }
    1 回复
  • 2024-08-20 19:40
    //更正版本! #include <bits/stdc++.h> #include <windows.h> using namespace std; string a[50]; int cn ; void _help(int s) { if (cn == 0) { cout << "提示次数为0!"; Sleep(880); cout << "\033c"; cout<<a[s]<<endl; return; } if (s == 2) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 7) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 8) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 9) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 13) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 14) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 15) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 16) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 17) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 18) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 20) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 21) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 23) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 27) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 28) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 29) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 30) { cout << "May be 1" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 32) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if(s==36){ cout<<"May be 2"<<endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 37) { cout << "May be 3" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } if (s == 40) { cout << "May be 2" << endl; cn--; cout << "剩余提示次数:" << cn << endl; Sleep(3000); cout << "\033c"; } cout<<a[s]<<endl; return; /* if(s==2){ cout<<"May be 2"<<endl; cn--; cout<<"剩余提示次数:"<<cn<<endl; sleep(500); cout << "\033c"; } */ } /* 这是一个c++小游戏。(程序自创,文章内容参考《牛津英汉双语读物·入门级·上<生存游戏>》) 1.1.0 版本升级点: 1.修复了一些乱码及a[24]、a[36]的文字问题 2.新增help功能 */ int main() { a[1] = "你名叫xx,正驾驶一架小型飞机飞越落基山脉。突然,发动机发出了奇怪的响声,飞机朝着一座山坠去。你的无线电失灵了,没有人知道你所在的位置。\n输入0继续"; a[2] = "你穿着外套,拿着威士忌和地图,过了大约20分钟。积雪很厚,你感到很冷。\n1你回到飞机上,拿了一些其他物品。\n2为了暖和一点,你喝了威士忌。"; a[3] = "你回去睡觉,再也没听到直升机的声响。第2天,你继续沿着河边走。"; a[4] = "你原路返回,出了隧道,走进乱石丛生的山谷。"; a[5] = "你吃了果子。虽然味道不好,但是你太饿了,还是吃了不少。你带了些果子在身上,过后可以吃。"; a[6] = "你穿着外套,拿着香蕉和打火机,走了大约20分钟。积雪很厚,你感到很冷。你回到树林,生起火堆。"; a[7] = "又到了晚上,但因为之前吃了鱼,你并没有觉得饿。你在树下搭了一座帐棚。早上醒来后,你听到了一阵响声。\n你跑出帐棚往天上看,发现有一架直升机。虽然你看得直升机,但因为树枝的遮挡,飞机上的人看不到你。飞机就要飞走了。\n1你追着直升机跑。\n2你回棚里睡觉。\n3你生起了火堆。 \n4你冲着直升机一边大声呼喊,一边挥动双臂。"; a[8] = "你顺着山谷走出很远,夜晚将要来临了。你在树林里生起了火,吃了香蕉。第2天早上,你感到很饿,必须找些东西吃。你在雪地上发现了动物的脚印,也许你可以猎杀这只动物作食物。\n1你沿着脚印追踪走去。\n2你很害怕大型动物。或许这只动物很危险,于是你向山下走去。"; a[9] = "你带着香蕉、打火机和地图走了几分钟,感到非常寒冷。\n1你生起火堆?。\n2你回到飞机上去取威士忌。"; a[10] = "时间到了下午。你开始觉得很不舒服。也许那些果子有毒。你走不动了,坐在雪地上,觉得越来越冷。"; a[11] = "你向右转,飞机撞到了树上。"; a[12] = "你横穿湖面,在冰上走。几分钟后,冰裂开了,你掉进了冰窟窿。"; a[13] = "你带着威士忌、打火机和香蕉走了几分钟,感到非常寒冷。\n1你喝了威士忌。\n2你回到飞机上,放下了威士忌,带上了外套。"; a[14] = "河面上结了冰,但中间有洞隙。你看到河里有鱼。也许你可以抓一条鱼吃。\n1你试着从冰隙间捉几条鱼。\n2在河边捉鱼很危险。你继续往前走。"; a[15] = "你向左转,想在雪地上着陆。飞机落在雪中,停了下来。你虽然安全了,但却身处山顶,天异常寒冷。天黑了下来。 \n1你待在飞机上。\n2你向山下走去。"; a[16] = "山谷的岩石很难攀爬,几分钟之后你就疲惫不堪了。\n1你继续沿着山谷走。\n2你往回走,出了山谷,进了隧道。"; a[17] = "你穿过树林向山下走,感觉饥肠辘辘。你看到有一棵树上结着没见过的果子。\n1你吃了果子。\n2你不吃果子。"; a[18] = "你小心地走上湖面。走了几百米后,脚下的冰开始晃动。\n1你继续在湖面上穿行。\n2你退了回去,然后绕着湖走。"; a[19] = "你重新生起火堆。大概两个小时后,你又听到了直升机的声响。这一次,飞机看到了烟,停在了你旁边的雪地上。这下你安全了。你乘飞机前往医院,可以在那里吃饭和休息。"; a[20] = "你极快地向林中坠去,但你可以让飞机向左转弯或向右转弯。右边是一些树,左边是厚厚的积雪。\n1你向右转。\n2你向左转。"; a[21] = "你继续沿着河走,感觉非常饥饿,必须找东西吃。树上有果子,河中有鱼。\n1你尝试着抓一条鱼。\n2你吃了一些果子。"; a[22] = "绳子断了。"; a[23] = "你继续在雪中跋涉。没有吃的东西,但你可以生火,还可以喝雪水。突然,你发现前面有一个结了冰的湖。\n1你横穿湖面。这样会快一些,你必须找点吃的东西。\n2你绕着湖?。你去寻找条河。"; a[24] = "你待在飞机上,但感到异常寒冷。你真的不想活了吗?"; a[25] = "你在飞机上待了四天,什么也看不到,什么也听不到。你必须下山。"; a[26] = "经过几十分钟的努力,你终于捉到了一条鱼。你又多捉了几条。你感到很冷,于是生起了火堆,烤了几条鱼吃。味道好极了。"; a[27] = "你朝山下走去。几分钟后看到前面有一条隧道。你的左侧还有一个布满岩石的山谷。\n1你沿着山谷走去。\n2你走进隧道。"; a[28] = "你绕着湖走。走约大了五公后,你发现了一条河。河水从湖中流出,向远处流去。\n1你继续绕着湖走。\n2你沿着河走去。"; a[29] = "你想下山。飞机上有一些东西,你可以随身带上几样。你会带哪些呢?\n1外套、威士忌和地图。\n2外套、香蕉和打火机。\n3香蕉、打火机和地图。\n4威士忌、打火机和香蕉。"; a[30] = "一整天,烟不停地升上天空,但是直升机没有出现。你等了一整天。第2天,你一大早就醒来了。\n1你重新生起火堆。\n2你沿着河走去。"; a[31] = "你追着直升机跑,但它飞得很快。你不得不往山上爬,在厚厚的雪中跋涉了一整天,但再也没找到那架直升机。"; a[32] = "你待在飞机附近。坐在一边,看着天,就这样过了两天。什么也没有发生。\n1你待在飞机附近。\n2你试着向山下走去。"; a[33] = "你走进隧道。漆黑一片。你看到有一盏灯,便点上了。"; a[34] = "为了暖和一点儿,你喝了威士忌,但并没有觉得暖和起来。你只是感到很累,筋疲力尽。"; a[35] = "你生起火堆,火堆冒出很多烟。你看着冲天的烟柱。"; a[36] = "你整晚都坐在树林里的火堆前。虽然天很冷,但火烧得很旺,你可以稍微睡一会。你需要想想天亮以后你可以做些什么。\n1你待在飞机附近。\n2你朝山下走去。"; a[37] = "你冲着直升机一边大声呼喊,一边挥动双臂。直升机掉头往回飞了一会,然后向天上飞去。\n1你追着直升机跑。\n2你回去睡觉。\n3你生起火堆。"; a[38] = "你绕着湖走了1整圈,筋疲力尽,没有找到任何事物。你只能沿着河走。"; a[39] = "你沿着脚印在树林中走了很远。脚印延伸到1棵大树的后面。你朝树后看去,看到了一只大熊。这肯定不是能吃的。你悄悄地离开了。"; a[40] = "你向洞的深处走,走了约5分钟,发现地上有一个很大的洞。1条很旧的绳向下直延伸到洞中。\n1你顺着绳子下到洞中。\n2你退回到隧道口。"; cout << "-------------生存游戏--------------" << endl; Sleep(1000); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(300); cout << "版"; Sleep(300); cout << "本"; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "1"; Sleep(300); cout << "."; Sleep(300); cout << "0" ; Sleep(300); cout << ' ' << "-"; cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; Sleep(100); cout<<"-"; cout<<endl; Sleep(980); cout<<"1.1.0版本升级点: \n"; Sleep(800); cout<<"1.修复了一些乱码及a[24]、a[36]的文字问题"<<endl; Sleep(510); cout<<"2.新增help功能 \n"; Sleep(1010); cn=5; cout << "注意事项:如果拿不定主意,可以输入数字5。求助次数为5。"<<endl; Sleep(500); cout << "输入任意字符开始游戏" << endl; int as; cin >> as; int s = 1; cout << "\033c"; while (1) { int b, c = 0, d = 0, e; if (s == 1) { cout << a[1] << endl; s = 20; cin >> b; cout << "\033c"; } if (s == 2) { cout << a[2] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 29; } if (b == 2) { s = 34; } cout << "\033c"; } if (s == 3) { cout << a[3] << endl; cin >> b; s = 21; cout << "\033c"; } if (s == 4) { cout << a[4] << endl; cin >> b; s = 16; cout << "\033c"; } if (s == 5) { cout << a[5] << endl; s = 10; cin >> b; cout << "\033c"; } if (s == 6) { cout << a[6] << endl; s = 36; cin >> b; cout << "\033c"; } if (s == 7) { cout << a[7] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } if (b == 4) { s = 37; } cout << "\033c"; } if (s == 8) { cout << a[8] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 39; } if (b == 2) { s = 17; } cout << "\033c"; } if (s == 9) { cout << a[9] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 36; } if (b == 2) { s = 34; } cout << "\033c"; } if (s == 10) { cout << a[10] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 11) { cout << a[s] << endl; cin >> b; cout << "\033c"; s = 1; } if (s == 12) { cout << a[12] << endl; cin >> b; cout << "\033c"; } if (s == 13) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 34; } if (b == 2) { s = 6; } cout << "\033c"; } if (s == 14) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 21; } cout << "\033c"; } if (s == 15) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 24; } if (b == 2) { s = 29; } cout << "\033c"; } if (s == 16) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 8; } if (b == 2) { s = 33; } cout << "\033c"; } if (s == 17) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 5; } if (b == 2) { s = 23; } cout << "\033c"; } if (s == 18) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 12; } if (b == 2) { s = 28; } cout << "\033c"; } if (s == 19) { cout << a[s] << endl; cout << "GAME OVER!"; break; cout << "\033c"; } if (s == 20) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 11; } if (b == 2) { s = 15; } cout << "\033c"; } if (s == 21) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 26; } if (b == 2) { s = 5; } cout << "\033c"; } if (s == 22) { cout << a[s] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 23) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 18; } if (b == 2) { s = 28; } cout << "\033c"; } if (s == 24) { cout << a[s] << endl; cin >> b; s = 29; cout << "\033c"; } if (s == 25) { cout << a[s] << endl; cin >> b; s = 27; cout << "\033c"; } if (s == 26) { cout << a[s] << endl; cin >> b; s = 7; cout << "\033c"; } if (s == 27) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 16; } if (b == 2) { s = 33; } cout << "\033c"; } if (s == 28) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 38; } if (b == 2) { s = 14; } cout << "\033c"; } if (s == 29) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 2; } if (b == 2) { s = 6; } if (b == 3) { s = 9; } if (b == 4) { s = 13; } cout << "\033c"; } if (s == 30) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 19; } if (b == 2) { s = 21; } cout << "\033c"; } if (s == 31) { cout << a[s] << endl; cin >> b; s = 23; cout << "\033c"; } if (s == 32) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 25; } if (b == 2) { s = 27; } cout << "\033c"; } if (s == 33) { cout << a[s] << endl; cin >> b; s = 40; cout << "\033c"; } if (s == 34) { cout << a[s] << endl; cin >> b; s = 1; cout << "\033c"; } if (s == 35) { cout << a[s] << endl; cin >> b; s = 30; cout << "\033c"; } if (s == 36) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 32; } if (b == 2) { s = 27; } cout << "\033c"; } if (s == 37) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 31; } if (b == 2) { s = 3; } if (b == 3) { s = 35; } cout << "\033c"; } if (s == 38) { cout << a[s] << endl; cin >> b; s = 14; cout << "\033c"; } if (s == 39) { cout << a[s] << endl; cin >> b; s = 17; cout << "\033c"; } if (s == 40) { cout << a[s] << endl; cin >> b; if (b == 5) { _help(s); cin >> b; } if (b == 1) { s = 22; } if (b == 2) { s = 4; } cout << "\033c"; } /* if(s==){ cout<<a[s]<<endl; cin>>b; cout << "\033c"; } */ } //cout << "\033c"; //cout << "\033c"; }
    1 回复
  • 2024-08-07 22:10
    程序里有一些“?”是因为c++乱码造成的,我修复了一部分,但仍有一些小问题,不影响阅读
    0 回复
  • 2024-08-07 21:53
    @a(O(∩_∩)O~2)[91小键人客服] thanks
    0 回复
  • 2024-08-07 21:19
    也是一个牛人呀face[围观]
    1 回复
  • 2024-08-07 21:05
    img[community/20240807/1723035936032317.png] 炸裂了
    3 回复
首页 上一页 1 2 到第 总共 2 页
有账号去 登录 ,无账号 去打字 可自动生成!
还未登录,登录