c++游戏大厅(不定时更新)1.6版本
shizhixuan游戏大厅1.6版本这个是以前的更新版之前的网址c游戏大厅不定时更新1.5版本-CSDN博客文章浏览阅读265次。1.修复了一些已知bug。2.更新了传奇打怪的存档。https://blog.csdn.net/shizhixuan1314/article/details/142553161?sharetypeblogdetailsharerId142553161sharereferPCsharesourceshizhixuan1314spm1011.2480.3001.8118更新日志1.修复了一些已知bug2.更新了传奇打怪3.优化了部分代码效果不变4.增加了种树游戏的存档内容#includebits/stdc.h #includeiostream #includewindows.h #includeconio.h #define msl VK_LBUTTON using namespace std; typedef long long ll; void putstring(string s,int t){ for(int i0;is.size();i)couts[i],Sleep(t); } HANDLE houtGetStdHandle(STD_OUTPUT_HANDLE); COORD coord; void xy(int x,int y){ coord.Xy,coord.Yx; SetConsoleCursorPosition(hout,coord); } void hide(){ CONSOLE_CURSOR_INFO cursor_info{20,0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),cursor_info); } void color(int c){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),c);} void windowsize(int c,int r){ char cmd[64]; sprintf(cmd,mode con cols%d lines%d,r,c); system(cmd); } void mouse(int mx,int my){ HANDLE houtGetStdHandle(STD_OUTPUT_HANDLE); HWND hGetForegroundWindow(); CONSOLE_FONT_INFO consoleCurrentFont; POINT p; GetCursorPos(p); ScreenToClient(h,p); GetCurrentConsoleFont(hout, FALSE, consoleCurrentFont); p.x/consoleCurrentFont.dwFontSize.X; p.y/consoleCurrentFont.dwFontSize.Y; mxp.y; myp.x; } void f(){ HANDLE hStdinGetStdHandle(STD_INPUT_HANDLE); DWORD mode; GetConsoleMode(hStdin,mode); mode~ENABLE_QUICK_EDIT_MODE; SetConsoleMode(hStdin,mode); return ; } int mx,my,sx,sy; bool is_mouse(int u,int d,int l,int r){ mouse(mx,my); if(mxumxdmylmyr)return 1; return 0; } void shutdown(){ system(cls); system(color 0c); system(shutdown -s -t 10); for(int i10;i1;i--){ couti; Sleep(1000); system(cls); } } void restart(){ system(cls); system(color 0c); system(shutdown -r -t 10); for(int i10;i1;i--){ couti; Sleep(1000); system(cls); } } void type(){ system(cls); const int esc27,imax60; bool a; cout打字游戏输入任意字符开始输完按回车ESC结束空格暂停endl; string agg; cinagg; cout请设置难度数字越大越简单数字太大可能出现bug推荐100; int ac; cinac; char ch0,key0,e0; int t0,r0; srand(time(0)); while(true){ keyrand()%2697; a0; for(int i1;iimax;i){ cout\b-char(key); Sleep(ac); if(kbhit()(chgetch())key){ r; cout*endl; a1; break; } if(chesc){ coutendl退出中.....endl; Sleep(2000); cout练习总数t 正确数量rendl; system(pause); return; } if(ch32){ coutendl; system(pause); ch0; } } if(a0)coutendl; t; } } void hhh(){ system(cls); srand(time(0)); while(true){ char ansrand()%128; coutans; } } void zs(){ int t1,a0,mny0,sz0,cs0,b0; int bol0; system(cls); putstring(欢迎来到种树游戏\n,100); Sleep(2000); while(true){ system(cls); cout0.读档 1.查看状态 2.浇水 3.拔苗助长 4.看医生 5.卖了还钱 6.商店 7.使用道具 8.退出 9.存档endl; int n; char ccch; while(!kbhit()(ccchgetch())){ n(ccch^48); break; } system(cls); if(n0){ ifstream ifile; ifile.open(种树游戏.zs); ifiletamnybolszcsb; if(mny 10000000){ cout \n作者很反感作弊帮你把存档删了。你的账号已恢复至初始状态。\n;system(pause); ofstream file; file.open(种树游戏.zs, ios::out); file.close(); } cout读档成功endl; system(pause); } if(n9){ ofstream file; file.open(种树游戏.zs, ios::out); filet a mny bol sz cs b; file.close(); cout存档成功endl; system(pause); } if(n1){ cout你的树t厘米高endl; if(bol0)cout当前健康endl; else cout你的树有问题endl; cout有mny个金币endl; for(int i1;it;i){ cout *endl; } cout***************endl; system(pause); system(cls); } if(n2){ if(bol2){ cout浇水完毕endl长高了一厘米endl; t; } else if(bol2){ cout你的树有问题无法浇水endl; } system(pause); system(cls); } if(n3){ a; if(b1)a--; if(a6){ cout成功拔苗助长endl; cout长高了3厘米endl; t3; } if(b0){ if(a3)bol1; if(a6){ cout你的树非常有问题endl; cout拔苗助长失败endl; cout矮了5厘米endl; t-5; bol2; } } system(pause); system(cls); } if(n4){ cout看医生需要5金币endl; cout是否付款1 是0 否endl; int n; cinn; if(n0)continue; if(mny5){ cout你没有钱endl; system(pause); system(cls); continue; } else if(mny5){ cout治疗成功endl; mny-5; bol0; a0; system(pause); system(cls); } } if(n5){ if(bol2){ cout因为你的树有问题所以只有一个金币endl; t1; a0; bol0; mny; system(pause); system(cls); continue; } if(t5){ cout树低于5厘米不能卖出endl; system(pause); system(cls); } else{ mnyt/5; cout得到t/5金币endl; system(pause); system(cls); } t1; a0; bol0; } if(n6){ cout1.生长药 100金币 2.长生不老药拔苗助长不会生病50000金币 输入任意其他数字退出endl; int hh; cinhh; if(hh1){ if(mny100){ cout你没有钱endl; system(pause); system(cls); continue; } else if(mny100){ cout购买成功endl; mny-100; sz; system(pause); system(cls); } } else if(hh 2){ if(mny50000){ cout你没有钱endl; system(pause); system(cls); continue; } else if(mny50000){ cout购买成功endl; mny-50000; cs; system(pause); system(cls); } } } if(n7){ if(sz1)cout1.生长药*szendl; if(cs1)cout2.长生不老药*csendl; if(sz0cs0){ cout你没有道具endl; system(pause); system(cls); continue; } int hh; cinhh; if(hh1sz){ cout长高了50厘米endl; t50; sz--; } if(hh2cs){ cout使用完毕endl; cs--; b1; } system(pause); system(cls); } if(n8){ cout退出中.....endl; Sleep(500); system(cls); cout退出中....endl; Sleep(500); system(cls); cout退出中...endl; Sleep(500); system(cls); cout退出中..endl; Sleep(500); system(cls); cout退出中.endl; Sleep(500); system(cls); return; } } } string name; ll ok,gj12,mny; double fy,blood100; void cd(){ system(cls); if(nameshizhixuan){ cout恭喜你触发隐藏功能即将进入开挂模式请注意查看状态......; blood100000000000; fy1; gj10000000000; Sleep(3000); for(int i5;i1;i--){ system(cls); couti; Sleep(1000); } } if(namelvboyuan){ cout恭喜你触发隐藏功能即将进入朋友模式请注意查看状态......; blood50000000000; fy0.5; gj5000000000; Sleep(3000); for(int i5;i1;i--){ system(cls); couti; Sleep(1000); } } if(name开发者){ cout开发者测试模式已进入\n请输入血量; cinblood; cout\n请输入ok的值; cinok; cout\n请输入防御; cinfy; cout\n请输入攻击; cingj; cout\n请输入金币; cinmny; } while(1){ system(cls); if(blood0){ cout你已阵亡请退出游戏后重新创建用户进入游戏\n; system(pause); } string hh你要去干什么; cout欢迎回来:nameendl; if(ok0){ putstring(传奇打怪1.2.3经典版,100); coutendl; for(int i0; ihh.size(); i){ couthh[i]; Sleep(100); } } else{ cout传奇打怪1.2.3经典版endl; couthh; } ok1; coutendl1.打怪 2.武器 3.商店 4.状态 5.提示 6.保存 7.退出endl其它规则按照传统传奇endl; ll k; char ccch; while(!kbhit()(ccchgetch())){ k(ccch^48); break; } if(k1){ cout你要去哪里\n; cout1.退出\n; cout2.狗熊岭\n; cout3.青青草原\n; cout4.星斗大森林\n; cout5.冰火瀑布\n; int sp; char spcin; while(!kbhit()(spcingetch())){ sp(spcin^48); break; } if(sp1)continue; else if(sp2){ while(1){ int guaibd; system(cls); cout欢迎来到狗熊岭\n请选择是潜行还是大胆走; cout\n1.退出; cout\n2.潜行; cout\n3.大胆走\n; int iif; char iifcin; while(!kbhit()(iifcingetch())){ iif(iifcin^48); break; } system(cls); if(iif1)break; else if(iif2){ srand(time(0)); int guairand()%21; if(guai1){ guaibd100; cout你遇到了笨笨猫头鹰\n; system(pause); while(blood0guaibd0){ system(cls); double temp10*(1-fy); cout你受到了temp点伤害\n; blood-temp; cout剩余blood点生命\n; system(pause); cout笨笨受到了gj点伤害\n; guaibd-gj; cout剩余guaibd点生命\n; system(pause); } if(blood0){ cout你输了\n; system(pause); break; } else{ cout你赢了\n获得20个金币\n; mny20; system(pause); } } else{ guaibd150; cout你遇到了毛毛猴子\n; system(pause); while(blood0guaibd0){ system(cls); double temp20*(1-fy); cout你受到了temp点伤害\n; blood-temp; cout剩余blood点生命\n; system(pause); cout毛毛受到了gj点伤害\n; guaibd-gj; cout剩余guaibd点生命\n; system(pause); } if(blood0){ cout你输了\n; system(pause); break; } else{ cout你赢了\n获得25个金币\n; mny25; system(pause); } } } else if(iif3){ srand(time(0)); int guairand()%31; if(guai1){ guaibd100; cout你遇到了笨笨猫头鹰\n; system(pause); while(blood0guaibd0){ system(cls); double temp10*(1-fy); cout你受到了temp点伤害\n; blood-temp; cout剩余blood点生命\n; system(pause); cout笨笨受到了gj点伤害\n; guaibd-gj; cout剩余guaibd点生命\n; system(pause); } if(blood0){ cout你输了\n; system(pause); break; } else{ cout你赢了\n获得20个金币\n; mny20; system(pause); } } else if(guai2){ guaibd150; cout你遇到了毛毛猴子\n; system(pause); while(blood0guaibd0){ system(cls); double temp20*(1-fy); cout你受到了temp点伤害\n; blood-temp; cout剩余blood点生命\n; system(pause); cout毛毛受到了gj点伤害\n; guaibd-gj; cout剩余guaibd点生命\n; system(pause); } if(blood0){ cout你输了\n; system(pause); break; } else{ cout你赢了\n获得25个金币\n; mny25; system(pause); } } else if(guai3){ guaibd220; cout你遇到了吉吉国王猴子王\n; system(pause); while(blood0guaibd0){ system(cls); double temp20*(1-fy); cout你受到了temp点伤害\n; blood-temp; cout剩余blood点生命\n; system(pause); cout吉吉国王受到了gj点伤害\n; guaibd-gj; cout剩余guaibd点生命\n; system(pause); } if(blood0){ cout你输了\n; system(pause); break; } else{ cout你赢了\n获得50个金币\n; mny50; system(pause); } } } } } } if(k2){ system(cls); cout欢迎来到武器商店\n; cout请问你要买什么永久\n; cout1.退出\n; cout2.匕首10金币\n; cout3.弓无需箭20金币\n; cout4.弩40金币\n; cout5.雌雄双股剑50金币\n; cout6.龙鳞刀70金币\n; cout7.青龙偃月刀100金币\n; cout8.气枪200金币\n; cout9.水枪250金币\n; cout10.手枪300金币\n; cout11.连发手枪500金币\n; cout12.AK-47 1000金币\n; cout13.M16A4 1300金币\n; cout14.M416 1500金币\n; cout15.M4 2000金币\n; cout16.98K 2300金币\n; cout17.M24 2400金币\n; cout18.AWM 2500金币\n; cout19.散弹枪3000金币\n; cout20.RPG 4000金币\n; cout21.东风导弹 6666金币\n; cout22.核弹 8888金币\n; int gm; char gmcin; while(!kbhit()(gmcingetch())){ gm(gmcin^48); break; } if(gm 1){ continue; } else if(gm2){ if(mny10){ cout你买不起\n; system(pause); } else{ cout购买成功攻击20\n; gj20; mny-10; system(pause); } } else if(gm3){ if(mny20){ cout你买不起\n; system(pause); } else{ cout购买成功攻击40\n; gj40; mny-20; system(pause); } } } if(k3){ system(cls); cout欢迎来到商店\n; cout请问你要买什么一次性\n; cout1.退出\n; cout2.药 5金币\n; cout3.神奇药水 10金币\n; cout4.绷带12金币\n; cout5.医药箱15金币\n; cout6.全能医药箱20金币\n; cout7.仙丹18888金币\n; int gm; char gmcin; while(!kbhit()(gmcingetch())){ gm(gmcin^48); break; } if(gm 1){ continue; } else if(gm2){ if(mny5){ cout你买不起\n; system(pause); } else{ cout购买成功血量50\n; blood50; mny-5; system(pause); } } else if(gm3){ if(mny10){ cout你买不起\n; system(pause); } else{ cout购买成功血量110\n; blood110; mny-10; system(pause); } } } if(k4){ system(cls); cout当前血量blood\n; cout当前防御能力%fy*100\n; cout当前攻击能力gj\n; cout当前金币mny\n; system(pause); } if(k5){ system(cls); cout开挂代码新建用户时把用户名设置成shizhixuan\n; system(pause); } if(k6){ ofstream file; file.open(cq.txt, ios::out); filename blood fy gj; file.close(); cout存档成功endl; system(pause); } if(k7){ return; } } } void cq(){ cout欢迎来到传奇打怪文字版endl; cout请问你要打开什么模式endl1.新建用户endl2.加载存档endl; ll hhh; char cccch; while(!kbhit()(cccchgetch())){ hhh(cccch^48); break; } if(hhh1){ cout请输入你的名字; cinname; cd(); } if(hhh2){ ifstream ifile; ifile.open(cq.txt); ifilenamebloodfygj; if(name ! shizhixuan || name ! lvboyuan || name ! 开发者){ if(blood 100000){ cout \n作者很反感作弊帮你把存档删了。你的账号已恢复至初始状态。\n;system(pause); ofstream file; file.open(cq.txt, ios::out); file.close(); } } cd(); } } char tem[10005]; ll loc,expr(); ll fac(){ int res0; if(tem[loc](){ loc; resexpr(); loc; } else{ while(tem[loc]0tem[loc]9){ resres*10tem[loc]-0; loc; } } return res; } ll item(){ ll xfac(); while(tem[loc]*||tem[loc]/){ char chtem[loc]; ll yfac(); if(ch*)x*y; else x/y; } return x; } ll expr(){ ll xitem(); while(tem[loc]||tem[loc]-){ char chtem[loc]; ll yitem(); if(ch)xy; else x-y; } return x; } void jsq(){ system(cls); cout请输入一个包含,-,*,/,(),的式子以回车结束输入ESC退出endl; cout例如(35)/2endl; while(true){ cout请输入endl; cintem; loc0; if(tem[0]Etem[1]Stem[2]C)return; coutexpr()endl; system(pause); system(cls); } } void csyx(){ system(cls); int number,answer,t,i; srand(time(0)); answerrand()%100000001; printf(欢迎来到猜数游戏\n正在加载游戏0%%); Sleep(1000); system(cls); printf(欢迎来到猜数游戏\n正在加载游戏10%%); Sleep(1000); system(cls); printf(欢迎来到猜数游戏\n正在加载游戏17%%); Sleep(3000); system(cls); printf(欢迎来到猜数游戏\n正在加载游戏49%%); Sleep(2000); system(cls); printf(欢迎来到猜数游戏\n正在加载游戏78%%); Sleep(1000); system(cls); printf(欢迎来到猜数游戏\n正在加载游戏100%%); Sleep(1000); system(cls); cout请输入一个数字endl; cout1.自己猜endl; cout2.看人机猜endl; int n; char ccch; while(!kbhit()(ccchgetch())){ n(ccch^48); break; } if(n1){ while(true){ cout请输入一个1到10000000之间的数; cinnumber; t; if(numberanswer){ cout用了t次猜对endl; printf(请选择是否继续游戏\nA.退出 B.继续\n请输入大写字母以回车键结束\n); char ch; cinch; if(chA){ return; } else csyx(); } else if(numberanswer){ cout大了endl; } else { cout小了endl; } } } else if(n2){ ll l1,r10000000; while(lr){ ll mid(lr)/2; cout请输入一个1到10000000之间的数; Sleep(1000); coutmidendl; t; if(midanswer){ cout用了t次猜对endl; printf(请选择是否继续游戏\nA.退出 B.继续\n请输入大写字母以回车键结束\n); char ch; cinch; if(chA){ return; } else csyx(); } else if(midanswer){ cout大了endl; rmid-1; } else { cout小了endl; lmid1; } cout人机正在思考中请稍等endl; Sleep(3000); } } } int main(){ system(title shizhixuan游戏大厅); f();hide(); system(color F0); cout 请选择深色还是浅色模式; while(1){ if(is_mouse(4,4,27,33)){ xy(4,27),color(242),cout深色; if(GetKeyState(msl)0){ system(color 0F); } } else xy(4,27),color(240),cout深色; if(is_mouse(4,4,33,38)){ xy(4,33),color(242),cout浅色; if(GetKeyState(msl)0){ system(color F0); } } else xy(4,33),color(240),cout浅色; if(is_mouse(4,4,38,44)){ xy(4,38),color(242),cout选好了; if(GetKeyState(msl)0){ color(240); break; } } else xy(4,38),color(240),cout选好了; } while(true){ system(cls); putstring(欢迎进入shizhixuan游戏大厅\n,100); putstring(请输入一个数字\n,100); cout1.退出endl; cout2.十秒后关机endl; cout3.十秒后重启endl; cout4.打字游戏endl; cout5.刷屏建议关掉声音endl; cout6.种树游戏endl; cout7.传奇打怪endl; cout8.智能计算器endl; cout9.猜数游戏endl; int n; char cch; while(!kbhit()(cchgetch())){ n(cch^48); if(n1)return 0; else if(n2){ shutdown();break; } else if(n3){ restart();break; } else if(n4){ type();break; } else if(n5){ hhh();break; } else if(n6){ zs();break; } else if(n7){ cq();break; } else if(n8){ jsq();break; } else if(n9){ csyx();break; } } } return 0; }