自制小游戏

这是我的第一篇文章

我要发的是一个自制的小游戏,后续还会更新

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
	srand(time(0));
	cout<<"室外温度℃:";
	int t;
	cin>>t;
	getchar();
	if(t<=-22){
		cout<<"人体进入深度休眠";
	}else if(t<22){
		cout<<"多穿衣服";
	}else if(t<35){
		cout<<"正常穿衣";
	}else if(t<48){
		cout<<"少穿衣服";
	}else if(t<500){
		cout<<"人煮熟了";
	}else if(t==666){
		cout<<"你好像发现了什么\n你要继续吗?(Y是.N不是):";
		string ch,name;
		cin>>ch;
		getchar();
		if(ch=="Y"){
			system("cls");
			Sleep(500);
			cout<<"你穿越到了一个有怪兽存在的世界\n";
			Sleep(500);
			cout<<"不出意外的话马上就出意外了,你掉下悬崖了,但没死,还有了系统\n开始吧,马牛逼";
			Sleep(500);
			getchar();
			system("cls");
			cout<<"输入你的名字:";
			cin>>name;
			getchar();
			Sleep(500) ;
			system("cls");
			long long xue=100,gongji=50,jingyan=0,dengji=1,xuesx=100,shenjixy=100,qian=100;
			if(name=="cmh"||name=="陈明瀚"){
				cout<<"开发者?开发者2问开始\n";
				cout<<"开发者1问,开发者洛谷账号:";
				cin>>ch;
				getchar();
				if(ch=="chenminghan"){
					cout<<"正确,开发者2问,开发者一本通账号:"; 
					cin>>ch;
					getchar();
					if(ch=="13696934346"){
						cout<<"正确,血上线+999900,经验+10W";
						xuesx+=999900;
						xue=xuesx;
						jingyan+=100000;
						gongji=999900/2;
						while(jingyan>shenjixy){
						 	jingyan-=shenjixy;
						 	dengji++;
						 	shenjixy*=2;
						 }
						Sleep(1000);
						system("cls");
					}
				}
			}
			if(name=="SB"||name=="sb"||name=="2B"||name=="2b"||name=="大SB"||name=="大sb"||name=="傻逼"||name=="煞笔"){
				cout<<"解锁成就:自暴自弃";
				system("cls");
			}
			cout<<name<<",多么帅气的名字,开始吧!";
			getchar();
			system("cls");
			int a;
			while(1){
				cout<<"           菜   单   选   项\n----------------------------------------\n1.打怪\n2.商店\n3.查看\n4.退出\n----------------------------------------\n";
				cin>>a;
				getchar();
				system("cls");
				if(a==1){
					do{
						cout<<"小怪\n1 史莱姆(攻击20,血量100)\n2 1-3级三眼野猫(攻击40-120,血50-150)\n0 退出\n";
						cin>>a;
						getchar();
						int n=1,gsx,gsg;
						system("cls");
						if(a==1){
							gsx=100;
							gsg=20;
							while(gsx>0&&xue>0){
								cout<<"第"<<n<<"回合";
								gsx-=gongji;
								xue-=gsg;
								cout<<"史莱姆受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
								Sleep(500);
								cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
								Sleep(500);
								n++;
							}
							if(xue<=0&&gsx<=0){
								cout<<"你和史莱姆都死了";
								return 0;
							}else if(xue>0&&gsx<=0){
								 cout<<"你赢了,经验++,血上线++,钱++";
								 jingyan+=100;
								 xuesx+=50;
								 qian+=100;
								 gongji=25;
								 while(jingyan>shenjixy){
								 	jingyan-=shenjixy;
								 	dengji++;
								 	shenjixy*=2;
								 }
								 getchar();
								 system("cls");
							}else{
								cout<<"你死了";
								return 0;
							}
						}else if(a==2){
							int j=rand()%3+1;
							cout<<"你抽到了"<<j<<"级三眼野猫\n";
							gsx=j*50;
							gsg=j*40;
							while(gsx>0&&xue>0){
								cout<<"第"<<n<<"回合";
								gsx-=gongji;
								xue-=gsg;
								cout<<"三眼野猫受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
								Sleep(500);
								cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
								Sleep(500);
								n++;
							}
							if(xue<=0&&gsx<=0){
								cout<<"你和三眼野猫都死了";
								return 0;
							}else if(xue>0&&gsx<=0){
								 cout<<"你赢了,经验++,血上线++,钱++";
								 jingyan+=100;
								 xuesx+=50;
								 qian+=150;
								 gongji+=25;
								 while(jingyan>shenjixy){
								 	jingyan-=shenjixy;
								 	dengji++;
								 	shenjixy*=2;
								 }
								 getchar();
								 system("cls");
							}else{
								cout<<"你死了";
								return 0;
							}
						}
					} while(a);
				}else if(a==2){
					do{
						cout<<"1 治疗药水,一下回满(90元)\n2 木剑(攻击+10,15元)\n3 石剑(攻击+25,30元)\n4 铁剑(攻击+50,55元)\n5 金剑(攻击+200,210元)\n6 神剑(攻击+10000,10000元)\n0 退出"; 
						cin>>a;
						getchar();
						if(a==1&&qian>=90){
							qian-=90;
							xue=xuesx;
						}else if(a==2&&qian>=15){
							qian-=15;
							gongji+=10;
						}else if(a==3&&qian>=30){
							qian-=30;
							gongji+=25;
						}else if(a==4&&qian>=55){
							qian-=55;
							gongji+=50;
						}else if(a==5&&qian>=210){
							qian-=210;
							gongji+=200;
						}else if(a==6&&qian>=10000){
							qian-=10000;
							gongji+=10000;
						}else{
							cout<<"你没钱!!!";
						}
						system("cls");
					}while(a);
				}else if(a==3){
					cout<<"\t经验:"<<jingyan<<"    等级:"<<dengji<<"    还差"<<shenjixy-jingyan<<"可升级\n"<<"攻击力(血量上线的一半):"<<gongji<<"\n血量:"<<xue<<"血量上限:"<<xuesx;
					getchar();
					system("cls");
				}else if(a==4){
					return 0;
				}else{
					cout<<"没有此选项"; 
				}
			}
		}else{
			cout<<"好吧,人体蒸发了";
		}
	}else{
		cout<<"人体蒸发了";
	}
}
//本游戏由陈明瀚开发,如需转载,请标明转载处 

没账号版

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
    srand(time(0));
    cout<<"室外温度℃:";
    int t;
    cin>>t;
    getchar();
    if(t<=-22){
        cout<<"人体进入深度休眠";
    }else if(t<22){
        cout<<"多穿衣服";
    }else if(t<35){
        cout<<"正常穿衣";
    }else if(t<48){
        cout<<"少穿衣服";
    }else if(t<500){
        cout<<"人煮熟了";
    }else if(t==666){
        cout<<"你好像发现了什么\n你要继续吗?(Y是.N不是):";
        string ch,name;
        cin>>ch;
        getchar();
        if(ch=="Y"){
            system("cls");
            Sleep(500);
            cout<<"你穿越到了一个有怪兽存在的世界\n";
            Sleep(500);
            cout<<"不出意外的话马上就出意外了,你掉下悬崖了,但没死,还有了系统\n开始吧,马牛逼";
            Sleep(500);
            getchar();
            system("cls");
            cout<<"输入你的名字:";
            cin>>name;
            getchar();
            Sleep(500) ;
            system("cls");
            long long xue=100,gongji=50,jingyan=0,dengji=1,xuesx=100,shenjixy=100,qian=100;
            if(name=="cmh"||name=="陈明瀚"){
                cout<<"开发者?开发者2问开始\n";
                cout<<"开发者1问,开发者洛谷账号:";
                cin>>ch;
                getchar();
                if(ch=="chenminghan"){
                    cout<<"正确,开发者2问,开发者一本通账号:"; 
                    cin>>ch;
                    getchar();
                    if(ch=="13696934346"){
                        cout<<"正确,血上线+999900,经验+10W";
                        xuesx+=999900;
                        xue=xuesx;
                        jingyan+=100000;
                        gongji=999900/2;
                        while(jingyan>shenjixy){
                             jingyan-=shenjixy;
                             dengji++;
                             shenjixy*=2;
                         }
                        Sleep(1000);
                        system("cls");
                    }
                }
            }
            if(name=="SB"||name=="sb"||name=="2B"||name=="2b"||name=="大SB"||name=="大sb"||name=="傻逼"||name=="煞笔"){
                cout<<"解锁成就:自暴自弃";
                system("cls");
            }
            cout<<name<<",多么帅气的名字,开始吧!";
            getchar();
            system("cls");
            int a;
            while(1){
                cout<<"           菜   单   选   项\n----------------------------------------\n1.打怪\n2.商店\n3.查看\n4.退出\n----------------------------------------\n";
                cin>>a;
                getchar();
                system("cls");
                if(a==1){
                    do{
                        cout<<"小怪\n1 史莱姆(攻击20,血量100)\n2 1-3级三眼野猫(攻击40-120,血50-150)\n0 退出\n";
                        cin>>a;
                        getchar();
                        int n=1,gsx,gsg;
                        system("cls");
                        if(a==1){
                            gsx=100;
                            gsg=20;
                            while(gsx>0&&xue>0){
                                cout<<"第"<<n<<"回合";
                                gsx-=gongji;
                                xue-=gsg;
                                cout<<"史莱姆受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
                                Sleep(500);
                                cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
                                Sleep(500);
                                n++;
                            }
                            if(xue<=0&&gsx<=0){
                                cout<<"你和史莱姆都死了";
                                return 0;
                            }else if(xue>0&&gsx<=0){
                                 cout<<"你赢了,经验++,血上线++,钱++";
                                 jingyan+=100;
                                 xuesx+=50;
                                 qian+=100;
                                 gongji=25;
                                 while(jingyan>shenjixy){
                                     jingyan-=shenjixy;
                                     dengji++;
                                     shenjixy*=2;
                                 }
                                 getchar();
                                 system("cls");
                            }else{
                                cout<<"你死了";
                                return 0;
                            }
                        }else if(a==2){
                            int j=rand()%3+1;
                            cout<<"你抽到了"<<j<<"级三眼野猫\n";
                            gsx=j*50;
                            gsg=j*40;
                            while(gsx>0&&xue>0){
                                cout<<"第"<<n<<"回合";
                                gsx-=gongji;
                                xue-=gsg;
                                cout<<"三眼野猫受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
                                Sleep(500);
                                cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
                                Sleep(500);
                                n++;
                            }
                            if(xue<=0&&gsx<=0){
                                cout<<"你和三眼野猫都死了";
                                return 0;
                            }else if(xue>0&&gsx<=0){
                                 cout<<"你赢了,经验++,血上线++,钱++";
                                 jingyan+=100;
                                 xuesx+=50;
                                 qian+=150;
                                 gongji+=25;
                                 while(jingyan>shenjixy){
                                     jingyan-=shenjixy;
                                     dengji++;
                                     shenjixy*=2;
                                 }
                                 getchar();
                                 system("cls");
                            }else{
                                cout<<"你死了";
                                return 0;
                            }
                        }
                    } while(a);
                }else if(a==2){
                    do{
                        cout<<"1 治疗药水,一下回满(90元)\n2 木剑(攻击+10,15元)\n3 石剑(攻击+25,30元)\n4 铁剑(攻击+50,55元)\n5 金剑(攻击+200,210元)\n6 神剑(攻击+10000,10000元)\n0 退出"; 
                        cin>>a;
                        getchar();
                        if(a==1&&qian>=90){
                            qian-=90;
                            xue=xuesx;
                        }else if(a==2&&qian>=15){
                            qian-=15;
                            gongji+=10;
                        }else if(a==3&&qian>=30){
                            qian-=30;
                            gongji+=25;
                        }else if(a==4&&qian>=55){
                            qian-=55;
                            gongji+=50;
                        }else if(a==5&&qian>=210){
                            qian-=210;
                            gongji+=200;
                        }else if(a==6&&qian>=10000){
                            qian-=10000;
                            gongji+=10000;
                        }else{
                            cout<<"你没钱!!!";
                        }
                        system("cls");
                    }while(a);
                }else if(a==3){
                    cout<<"\t经验:"<<jingyan<<"    等级:"<<dengji<<"    还差"<<shenjixy-jingyan<<"可升级\n"<<"攻击力(血量上线的一半):"<<gongji<<"\n血量:"<<xue<<"血量上限:"<<xuesx;
                    getchar();
                    system("cls");
                }else if(a==4){
                    return 0;
                }else{
                    cout<<"没有此选项"; 
                }
            }
        }else{
            cout<<"好吧,人体蒸发了";
        }
    }else{
        cout<<"人体蒸发了";
    }
}
//本游戏由陈明瀚开发,如需转载,请标明转载处 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值