• 个人简介

    我是c++大佬程鹏龙(cpl) 人称:c++第一人

    我的小游戏

    #include<iostream>
    using namespace std;
    int main(){
      cout<<"欢迎来到cpl小游戏环节"<<endl;
      string s;
      cout<<"请输入自己的名字."<<endl;
      cin>>s;
      cout<<"恭喜你输入正确,开启游戏"<<endl;
      cout<<"请选择模式:"<<endl;
      cout<<"1:密室逃脱"<<endl;
      cout<<"2:对战黑客"<<endl;
      cout<<"3:战争风云"<<endl;
      cout<<"4:探险之路"<<endl;
      cout<<"5:鬼屋惊魂"<<endl;
      int n;
      cout<<"请输入对应编号"<<endl;
      cin>>n;
      if(n<1 or n>5){
        cout<<"你作弊,即将退出游戏"<<endl;
        return 0;
      } 
      if(n==1){
        cout<<"欢迎进入密室逃脱模式"<<endl;
        cout<<"第一关"<<endl;
        cout<<"你在一个屋子里,你要找寻线索"<<endl;
        cout<<"1:向上,2:向下"<<endl;
        int w;
        cin>>w;
        if(w==1){
          cout<<"请问:(燕山月似弓)的前一句是"<<endl;
          string h;
          cin>>h;
          if(h=="大漠沙如雪"){
            cout<<"回答正确,进入第二关"<<endl;
          }
          else{
            cout<<"回答错误,你死了,游戏结束"<<endl;
            return 0;
          }
        }
        if(w==2){
          cout<<"请问:(八九十枝花)的前一句是"<<endl;
          string h;
          cin>>h;
          if(h=="亭台六七座"){
            cout<<"回答正确,进入第二关"<<endl;
          }
          else{
            cout<<"回答错误,你死了,游戏结束"<<endl;
            return 0;
          }
        }
        cout<<"第二关"<<endl;
        cout<<"请问(人+人)=?(脑经急转弯)"<<endl;
        string rr;
        cin>>rr;
        if(rr=="从"){
          cout<<"回答正确,进入第三关"<<endl;
        }
        else{
          cout<<"回答错误,你死了,游戏结束"<<endl;
          return 0;
        }   
        cout<<"第三关"<<endl;
        cout<<"请问3.1415926*3=?"<<endl;
        int pai;
        cin>>pai;
        if(pai==9.4247778){
          cout<<"回答正确,恭喜你进入最后一关"<<endl;
        }
        else{
          cout<<"回答错误,你死了,游戏结束"<<endl;
          return 0;
        }
        cout<<"终极关卡"<<endl;
        cout<<"做一次选择吧,年轻人!!"<<endl;
        int u;
        cout<<"1:向下跳"<<endl;
        cout<<"2:向上飞"<<endl;
        cout<<"3:其他"<<endl;
        cin>>u;
        if(u==1){
          cout<<"下面是深渊,你gp了"<<endl;
          return 0;
        }
        if(u==2){
          cout<<"你又没翅膀,你gp了"<<endl;
          return 0;
        }
        if(u==3){
          cout<<"你逃出来了,恭喜你!!!"<<endl;
          cout<<"要想再玩,就再运行一次吧!!!"<<endl;
          cout<<"欢迎下次在来cpl小游戏环节!!!"<<endl;
          cout<<"热烈祝贺!!!!!!"<<endl;
          return 0;
        }
      }
      if(n==2){
        cout<<"欢迎来到对战黑客"<<endl;
        cout<<"他有100血量"<<endl;
        cout<<"而你只有99血量"<<endl;
        int xlzj;
        cout<<"输入一个数代表你要加的血量"<<endl;
        cin>>xlzj;
        int hk=100,ni=99;
        if(xlzj>5 or xlzj<0){
            cout<<"你太贪了,扣除血量5,你还剩94血量"<<endl;
        }
        else{
            ni+=xlzj;
            cout<<"你有血量"<<ni<<endl;
        }
        cout<<"黑客向你扑来"<<endl;
        ni-=5;
        cout<<"你扣血5滴"<<endl;
        cout<<"你可以花50滴血换取一个武器"<<endl;
        cout<<"1:可以 2:不可以"<<endl;
        int kyb;
        cin>>kyb;
        if(kyb==1){
            ni-=50;
            cout<<"获得突击枪一挺"<<endl;
            cout<<"黑客减血50"<<endl;
            hk-=50;
        }
        else{
            cout<<"你被黑客暴击,扣血50"<<endl;
        }
        ni-=5;
        hk-=10;
        ni-=23;
        if(kyb==1){
            cout<<"突击枪发作"<<endl;
            hk-=23;
        }
        hk-=10;
        cout<<"经过n年打斗,黑客的血量为"<<hk<<"你的血量为"<<ni<<endl;
        if(hk<=0){
            cout<<"你赢了"<<endl;
            return 0;
        }
        else{
            cout<<"黑客的幕后势力来了,你gp了"<<endl;
            return 0;
        }
      }
      return 0;
    }
    
  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.

题目标签

客观题
1