c++游戏大厅(不定时更新)

最新版已更新,请到最新版获取更多内容

shizhixuan游戏大厅火爆上线!!!
自编的c++游戏大厅,传奇打怪还没有编完,请不要打开,不定时更新(更新后会删除原文章)。

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
void shutdown(){
	system("cls");
	system("color 0c");
	system("shutdown -s -t 10");
	for(int i=10;i>=1;i--){
		cout<<i;
		Sleep(1000);
		system("cls");
	}
}
void restart(){
	system("cls");
	system("color 0c");
	system("shutdown -r -t 10");
	for(int i=10;i>=1;i--){
		cout<<i;
		Sleep(1000);
		system("cls");
	}
}
void type(){
	system("cls");
	const int esc=27,imax=60;
	bool a;
	cout<<"打字游戏(输入任意字符开始(输完按回车),ESC结束,空格暂停)"<<endl;
	string agg;
	cin>>agg;
	cout<<"请设置难度(数字越大越简单(数字太大可能出现bug),推荐100):";
	int ac;
	cin>>ac;
	char ch=0,key=0,e=0;
	int t=0,r=0;
	srand(time(0));
	while(true){
		key=rand()%26+97;
		a=0;
		for(int i=1;i<=imax;i++){
			cout<<"\b-"<<char(key);
			Sleep(ac);
			if(kbhit()&&(ch=getch())==key){
				r++;
				cout<<"*"<<endl;
				a=1;
				break;
			}
			if(ch==esc){
				cout<<endl<<"退出中....."<<endl;
				Sleep(2000);
				cout<<"练习总数:"<<t<<" 正确数量:"<<r;
				return;
			}
			if(ch==32){
				cout<<endl;
				system("pause");
				ch=0;
			}
		}
		if(a==0)cout<<endl;
		t++;
	}
}
void hhh(){
	system("cls");
	srand(time(0));
	while(true){
		char ans=rand()%128;
		cout<<ans;
	}
}
void zs(){
	int t=1,a=0,mny=0,sz=0,cs=0,b=0;
	int bol=0;
	system("cls");
	cout<<"欢迎来到种树游戏"<<endl;
	Sleep(2000);
	while(true){
		system("cls");
		cout<<"1.查看状态 2.浇水 3.拔苗助长 4.看医生 5.卖了还钱 6.商店 7.使用道具 8.退出"<<endl;
		int n;
		cin>>n;
		system("cls");
		if(n==1){
			cout<<"你的树"<<t<<"厘米高"<<endl;
			if(bol==0)cout<<"当前健康"<<endl;
			else cout<<"你的树有问题"<<endl;
			cout<<"有"<<mny<<"个金币"<<endl;
			for(int i=1;i<=t;i++){
				cout<<"       *"<<endl;
			}
			cout<<"***************"<<endl;
			system("pause");
			system("cls");
		}
		if(n==2){
			if(bol<2){
				cout<<"浇水完毕"<<endl<<"长高了一厘米"<<endl;
				t++;
			}
			else if(bol==2){
				cout<<"你的树有问题,无法浇水"<<endl;
			}
			system("pause");
			system("cls");
		}
		if(n==3){
			a++;
			if(b==1)a--;
			if(a<6){
				cout<<"成功拔苗助长"<<endl;
				cout<<"长高了3厘米"<<endl;
				t+=3;
			}
			if(b==0){
				if(a==3)bol=1;
				if(a>=6){
					cout<<"你的树非常有问题"<<endl;
					cout<<"拔苗助长失败"<<endl;
					cout<<"矮了5厘米"<<endl;
					t-=5;
					bol=2;
				}
			}
			system("pause");
			system("cls");
		}
		if(n==4){
			cout<<"看医生需要5金币"<<endl;
			cout<<"是否付款?1 是,0 否"<<endl;
			int n;
			cin>>n;
			if(n==0)continue;
			if(mny<5){
				cout<<"你没有钱"<<endl;
				system("pause");
				system("cls");
				continue;
			}
			else if(mny>=5){
				cout<<"治疗成功"<<endl;
				mny-=5;
				bol=0;
				a=0;
				system("pause");
				system("cls");
			}
		}
		if(n==5){
			if(bol==2){
				cout<<"因为你的树有问题,所以只有一个金币"<<endl;
				t=1;
				a=0;
				bol=0;
				mny++;
				system("pause");
				system("cls");
				continue;
			}
			if(t<=10){
				mny+=2;
				cout<<"得到2金币"<<endl;
				system("pause");
				system("cls");
			}
			else if(t>10&&t<=20){
				mny+=5;
				cout<<"得到5金币"<<endl;
				system("pause");
				system("cls");
			}
			else if(t>20&&t<=50){
				mny+=10;
				cout<<"得到10金币"<<endl;
				system("pause");
				system("cls");
			}
			else if(t>50&&t<=100){
				mny+=15;
				cout<<"得到15金币"<<endl;
				system("pause");
				system("cls");
			}
			else if(t>=100){
				mny+=20;
				cout<<"得到20金币"<<endl;
				system("pause");
				system("cls");
			}
			t=1;
			a=0;
			bol=0;
		}
		if(n==6){
			cout<<"1.生长药 100金币 2.长生不老药(拔苗助长不会生病)50000金币";
			int hh;
			cin>>hh;
			if(hh==1){
				if(mny<100){
					cout<<"你没有钱"<<endl;
					system("pause");
					system("cls");
					continue;
				}
				else if(mny>=100){
					cout<<"购买成功"<<endl;
					mny-=100;
					sz++;
					system("pause");
					system("cls");
				}
			}
			else{
				if(mny<50000){
					cout<<"你没有钱"<<endl;
					system("pause");
					system("cls");
					continue;
				}
				else if(mny>=50000){
					cout<<"购买成功"<<endl;
					mny-=50000;
					system("pause");
					system("cls");
				}
			}
		}
		if(n==7){
			if(sz>=1)cout<<"1.生长药*"<<sz<<endl;
			if(cs>=1)cout<<"2.长生不老药*"<<cs<<endl;
			else{
				cout<<"你没有道具"<<endl;
				system("pause");
				system("cls");
				continue;
			}
			int hh;
			cin>>hh;
			if(hh==1&&sz){
				cout<<"长高了50厘米"<<endl;
				t+=50;
				sz--;
			}
			if(hh==2&&cs){
				cout<<"使用完毕"<<endl;
				cs--;
				b=1;
			}
			system("pause");
			system("cls");
		}
		if(n==8)return;
	}
}
void cq(){
	system("cls");
	const int esc=27;
	cout<<"欢迎来到热血传奇!"<<endl;
	cout<<"请创建用户"<<endl;
	cout<<"请输入用户名:";
	string s;
	cin>>s;
	system("cls");
	cout<<s<<",正在转载游戏中";
	for(int i=1;i<=10;i++){
		cout<<".";
		Sleep(500); 
	}
	system("cls");
	cout<<"游戏规则:"<<endl;
	cout<<"WASD移动人物"<<endl;
	cout<<"选择地图请输入数字"<<endl;
	cout<<"ESC退出游戏"<<endl;
	cout<<"打怪过程中想使用回城石请按 " <<"="<<endl;
	system("pause");
	while(true){
		if(kbhit()&&getch()==esc){
			system("cls");
			cout<<"结束?1 是,0 否";
			bool temp;
			cin>>temp;
			if(temp==1)return;
			else system("cls");
		}
	}
}
int main(){
	while(true){
		system("cls");
		cout<<"欢迎进入shizhixuan游戏大厅"<<endl;
		cout<<"请输入一个数字"<<endl;
		cout<<"1.退出"<<endl;
		cout<<"2.十秒后关机"<<endl;
		cout<<"3.十秒后重启"<<endl;
		cout<<"4.打字游戏"<<endl;
		cout<<"5.刷屏(建议关掉声音)"<<endl;
		cout<<"6.种树游戏"<<endl;
		cout<<"7.传奇打怪"<<endl;
		int n;
		cin>>n;
		if(n==1)break;
		else if(n==2)shutdown();
		else if(n==3)restart();
		else if(n==4)type();
		else if(n==5)hhh();
		else if(n==6)zs();
		else if(n==7)cq();
	}
	return 0;
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值