GAME V2.15

· · 个人记录

#include<bits/stdc++.h>
#define int long long
using namespace std;
string name;
int dengji=1,fangyu=10,xiufu=1,nengyuan=50,nysx=50,hp=100,hpsx=100,rmb=0;
int yincang=1,tuijin=1;
int zhupao1=100,zhupao2=100;
int zpdj1=1,zpdj2=1,fangyudj=1,cangchudj=1;
int fupao1=30,fupao2=30,fupao3=30,fupao4=30;
int fpdj1=1,fpdj2=1,fpdj3=1,fpdj4=1;
int zpch1=1,zpch2=1,fpch1=1,fpch2=1,fpch3=1,fpch4=1;
int jlrmb[25]={0,100,300,500,1000,2500,4500,7000,10000,15000,20000,28000,38000,50000,70000,92000,112000};
int dengjijg[25]={0,100,1000,10000,30000,80000,120000,180000,250000,350000,500000};
void init(){
    cout<<"欢迎游玩由鬼一工作室制作的星际争霸,请您输入您战舰的名字:";
    cin>>name;
    system("cls");
}
void qinlue(){
    system("cls");
    int dfdengji=rand()%(dengji+2)+1;
    dfdengji+=rand()%(dengji+3);
    dfdengji/=2;
    dfdengji=min(dfdengji,20ll);
    if(dengji==1)dfdengji=1;
    int dfgj=rand()%(30+dfdengji*5)+1;dfgj=dfgj+(max(1ll,dengji-(rand()%3)))*15+dfdengji*15+rand()%(dfdengji*5);
    int dffy=rand()%dfdengji+1;dffy=dffy*2*(dfdengji*rand()%2+1);
    int dfxf=rand()%dfdengji+1;dfxf=dfxf*10;
    int dfzc=rand()%dfdengji+1;
    int dfhp=dfdengji*100;
    dfhp+=rand()%(dfhp/4);
    int h=rand()%100+1;
    if(h<=2)dfgj=max(dfgj+30,zhupao1);
    if(h>=99)dfhp=max(dfhp+130,hpsx);
    cout<<"敌方等级:"<<dfdengji<<"\n";
    cout<<"敌方血量:"<<dfhp<<"\n";
    cout<<"敌方攻击力:"<<dfgj<<"\n";
    cout<<"我方血量:"<<hp<<"\n";
    char x;
    if(dfzc<yincang) {
        cout<<"敌方未发现你,您可以进行 1.攻击 2.逃跑"<<"\n";
        cin>>x;
        if(x=='2') return;
        for(int i=1;i<=min((yincang-dfzc)/2,3ll);i++) {
            system("cls");
            cout<<"敌方血量:"<<dfhp<<" 目前有"<<nengyuan<<"点能源"<<"\n";
            if(zpch1==1)cout<<"1.主炮1 需"<<(zpdj1-1)*2+5<<"点能源 伤害"<<zhupao1<<endl;
            if(dengji>=4&&zpch2==1)cout<<"2.主炮2 需"<<(zpdj2-1)*2+5<<"点能源 伤害"<<zhupao2<<endl;
            if(dengji>=2&&fpch1==1)cout<<"3.副炮1 需"<<fpdj1+2<<"点能源 伤害"<<fupao1<<endl;
            if(dengji>=3&&fpch2==1)cout<<"4.副炮2 需"<<fpdj2+2<<"点能源 伤害"<<fupao2<<endl;
            if(dengji>=5&&fpch3==1)cout<<"5.副炮3 需"<<fpdj3+2<<"点能源 伤害"<<fupao3<<endl;
            if(dengji>=6&&fpch4==1)cout<<"6.副炮4 需"<<fpdj4+2<<"点能源 伤害"<<fupao4<<endl;
            cin>>x;
            if(x=='1'&& nengyuan>=(zpdj1-1)*2+5 &&zpch1==1){
                system("cls");
                nengyuan=nengyuan-((zpdj1-1)*2+5);
                int shanghai=max(0ll,zhupao1);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else if(x=='2'&& nengyuan>=(zpdj2-1)*2+5 && dengji>=4&&zpch2==1){
                system("cls");
                nengyuan=nengyuan-((zpdj2-1)*2+5);
                int shanghai=max(0ll,zhupao2);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else if(x=='3'&& nengyuan>=fpdj1+2 && dengji>=2&&fpch1==1){
                system("cls");
                nengyuan=nengyuan-(fpdj1+2);
                int shanghai=max(0ll,fupao1);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else if(x=='4'&& nengyuan>=fpdj2+2 && dengji>=3&&fpch2==1){
                system("cls");
                nengyuan=nengyuan-(fpdj2+2);
                int shanghai=max(0ll,fupao2);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else if(x=='5'&& nengyuan>=fpdj3+2 && dengji>=5 &&fpch3==1){
                system("cls");
                nengyuan=nengyuan-(fpdj3+2);
                int shanghai=max(0ll,fupao3);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else if(x=='6'&& nengyuan>=fpdj4+2 && dengji>=6 &&fpch4==1){
                system("cls");
                nengyuan=nengyuan-(fpdj4+2);
                int shanghai=max(0ll,fupao4);
                dfhp-=shanghai;
                cout<<"造成伤害"<<shanghai-dffy<<"\n";
            }
            else {cout<<"ERROR!指令错误,攻击失败!";continue;}
            cout<<"敌方剩余血量:"<<dfhp<<"\n";
            system("pause"),system("cls");
            if(dfhp<=0) {
                cout<<"敌舰被击毁\n";
                rmb+=jlrmb[dfdengji];
                cout<<"获得了"<<jlrmb[dfdengji]<<"RMB"<<"\n";
                system("pause"),system("cls");
                return;
            }
        }
    }
    cout<<"警告!被敌方发现!按2有50%几率逃走\n";
    char a;
    cin>>a;
    if(a=='2')
    {
        int h=rand()%10+2;
        system("cls");
        if(h<5)
        {
            cout<<"逃走成功!";
            _sleep(300);
            return ;
        }
    }
    while(dfhp>0 && hp>0){
        system("cls");
        cout<<"敌方血量:"<<dfhp<<" 目前有"<<nengyuan<<"点能源"<<"\n";
        cout<<"我方血量:"<<hp<<"\n";
        if(zpch1==1)cout<<"1.主炮1 需"<<(zpdj1-1)*2+5<<"点能源 伤害"<<zhupao1<<endl;
        if(dengji>=4&&zpch2==1)cout<<"2.主炮2 需"<<(zpdj2-1)*2+5<<"点能源 伤害"<<zhupao2<<endl;
        if(dengji>=2&&fpch1==1)cout<<"3.副炮1 需"<<fpdj1+2<<"点能源 伤害"<<fupao1<<endl;
        if(dengji>=3&&fpch2==1)cout<<"4.副炮2 需"<<fpdj2+2<<"点能源 伤害"<<fupao2<<endl;
        if(dengji>=5&&fpch3==1)cout<<"5.副炮3 需"<<fpdj3+2<<"点能源 伤害"<<fupao3<<endl;
        if(dengji>=6&&fpch4==1)cout<<"6.副炮4 需"<<fpdj4+2<<"点能源 伤害"<<fupao4<<endl;
        cout<<"0.逃跑 有"<<min(tuijin*10,100ll)<<"%的几率逃走\n";
        cin>>x;
        if(x=='1'&& nengyuan>=(zpdj1-1)*2+5 &&zpch1==1){
            system("cls");
            nengyuan=nengyuan-((zpdj1-1)*2+5);
            int shanghai=max(0ll,zhupao1);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='2'&& nengyuan>=(zpdj2-1)*2+5 && dengji>=4&&zpch2==1){
            system("cls");
            nengyuan=nengyuan-((zpdj2-1)*2+5);
            int shanghai=max(0ll,zhupao2);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='3'&& nengyuan>=fpdj1+2 && dengji>=2&&fpch1==1){
            system("cls");
            nengyuan=nengyuan-(fpdj1+2);
            int shanghai=max(0ll,fupao1);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='4'&& nengyuan>=fpdj2+2 && dengji>=3&&fpch2==1){
            system("cls");
            nengyuan=nengyuan-(fpdj2+2);
            int shanghai=max(0ll,fupao2);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='5'&& nengyuan>=fpdj3+2 && dengji>=5 &&fpch3==1){
            system("cls");
            nengyuan=nengyuan-(fpdj3+2);
            int shanghai=max(0ll,fupao3);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='6'&& nengyuan>=fpdj4+2 && dengji>=6 &&fpch4==1){
            system("cls");
            nengyuan=nengyuan-(fpdj4+2);
            int shanghai=max(0ll,fupao4);
            dfhp-=shanghai;
            cout<<"造成伤害"<<shanghai-dffy<<"\n";
        }
        else if(x=='0'){
            int tem=rand()%10+1;
            if(tem<=tuijin) {
                cout<<"你成功的逃走了\n";
                system("pause"),system("cls");
                system("cls");
                return;
            }
            else{
                cout<<"逃跑失败!\n";
                system("pause"),system("cls");
                system("cls");
            }
        }
        else {cout<<"ERROR!指令错误,攻击失败!";continue;}
        cout<<"敌方剩余血量:"<<dfhp<<"\n";
        system("pause"),system("cls");
        if(dfhp<=0)break;
        cout<<"我方血量:"<<hp<<endl;
        cout<<"预计伤害:"<<max(dfgj-fangyu,0ll)<<endl;
        cout<<"是否开盾?(1.是 2.否)可开盾上限:"<<fangyudj*5<<endl;
        cout<<"剩余能源:"<<nengyuan<<" 需消耗:"<<fangyudj*2<<endl;
        char a;
        int hh=0;
        cin>>a;
        system("cls");
        if(a=='1'&&nengyuan>=fangyudj*2)
        {
            hh=max(fangyudj,rand()%(fangyudj*5)+1);
            nengyuan-=fangyudj*2;
            cout<<"已生成护盾 生命:"<<hh<<endl;
        }
        int shanghai=max(dfgj-fangyu-hh,0ll);
        cout<<"敌方对你造成了"<<shanghai<<"点伤害\n";
        hp-=shanghai;
        int h=0;
        if(hp<hpsx/2) h=rand()%3;
        if(h==1)
        {
            if(zpch1==1)
            {
                zpch1=0;
                cout<<"主炮1已损坏\n";
            }
            else if(zpch2==1 && dengji>=4)
            {
                zpch2=0;
                cout<<"主炮2已损坏\n";
            }
            else if(fpch1==1 && dengji>=2)
            {
                fpch1=0;
                cout<<"副炮1已损坏\n";
            }
            else if(fpch2==1 && dengji>=3)
            {
                fpch2=0;
                cout<<"副炮2已损坏\n";
            }
            else if(fpch3==1 && dengji>=5)
            {
                fpch3=0;
                cout<<"副炮3已损坏\n";
            }
            else if(fpch4==1 && dengji>=6)
            {
                fpch4=0;
                cout<<"副炮4已损坏\n";
            }
        } 
        cout<<"剩余血量:"<<hp<<"\n";
        system("pause"),system("cls");
        if(hp<=0||dfhp<=0)break;
        system("cls");
        cout<<"你恢复了"<<xiufu*10<<"点生命\n";
        hp+=xiufu*2;hp=min(hp,hpsx);
        cout<<"敌方恢复了"<<dfxf<<"点生命\n";
        dfhp+=dfxf;if(dfhp>dfdengji*100) dfhp=dfdengji*100;
        system("pause"),system("cls");
        system("cls");
    }
    if(dfhp<=0 && hp<=0){
        system("cls");
        cout<<"你与敌舰同归于尽,";
        cout<<"获得了"<<jlrmb[dfdengji]/2<<"RMB"<<"\n";
        rmb+=jlrmb[dfdengji]/2;
        hp=hpsx;nengyuan=nysx;zpch1=zpch2=fpch1=fpch2=fpch3=fpch4=1;
        system("pause"),system("cls");
        system("cls");
        return;
    }
    if(dfhp<=0) {
        cout<<"敌舰被击毁\n";
        rmb+=jlrmb[dfdengji];
        cout<<"获得了"<<jlrmb[dfdengji]<<"RMB"<<"\n";
        system("pause"),system("cls");
        return;
    }
    else if(hp<=0){
        system("cls");
        cout<<"警告!!!我方战舰被击毁!!!\n";
        cout<<"警告!!!我方战舰被击毁!!!\n";
        cout<<"警告!!!我方战舰被击毁!!!\n";
        system("pause"),system("cls");
        system("cls");
        cout<<"遗失了"<<min(rmb/2,jlrmb[dengji+1]*2)<<"的RMB\n";
        system("pause"),system("cls");
        system("cls");
        rmb=rmb-min(rmb/2,jlrmb[dengji+1]*2);
        hp=hpsx;nengyuan=nysx;zpch1=zpch2=fpch1=fpch2=fpch3=fpch4=1;
        return;
    }
    return;
}
void kongzhishi()
{
    system("cls");
    cout<<"你共有"<<rmb<<"RMB"<<endl; 
    cout<<"升级控制室共需"<<dengjijg[dengji]<<"RMB\n";
    cout<<"防御力+5 血量上限+100 能源上限+15\n";
    cout<<"是否升级(1.是  2.退出)\n"<<endl;
    char a;
    cin>>a;
    if(a=='1'&&dengjijg[dengji] && rmb>=dengjijg[dengji])
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=dengjijg[dengji];
        dengji++;
        fangyu+=5;
        hpsx+=100;
        nysx+=15;
        cout<<"当前等级"<<dengji<<endl;
        cout<<"剩余RMB"<<rmb<<endl;
        hp=hpsx;
        nengyuan=nysx;
        zpch1=zpch2=fpch1=fpch2=fpch3=fpch4=1;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='2')
    {
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能RMB不够)"<<endl; 
        system("pause"),system("cls");
        kongzhishi(); 
    }
}
void gongjixitong()
{
    system("cls");
    cout<<"你共有"<<rmb<<"RMB"<<endl; 
    cout<<"1.升级主炮1共需"<<(long long)pow(2,zpdj1+7)<<"RMB 目前"<<zpdj1<<"级"<<endl;
    if(dengji>=4)cout<<"2.升级主炮2共需"<<(long long)pow(2,zpdj2+9)<<"RMB 目前"<<zpdj2<<"级"<<endl;
    if(dengji>=2)cout<<"3.升级副炮1共需"<<(long long)pow(2,fpdj1+7)<<"RMB 目前"<<fpdj1<<"级"<<endl;
    if(dengji>=3)cout<<"4.升级副炮2共需"<<(long long)pow(2,fpdj2+9)<<"RMB 目前"<<fpdj2<<"级"<<endl;
    if(dengji>=5)cout<<"5.升级副炮3共需"<<(long long)pow(3,fpdj3+6)<<"RMB 目前"<<fpdj3<<"级"<<endl;
    if(dengji>=6)cout<<"6.升级副炮4共需"<<(long long)pow(3,fpdj4+7)<<"RMB 目前"<<fpdj4<<"级"<<endl;
    cout<<"x.退出"<<endl;
    char a;
    cin>>a;
    if(a=='x')
    {
        system("cls");
        return ;
    }
    if(a=='1'&&rmb>=pow(2,zpdj1+7)&&zpdj1<dengji)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(2,zpdj1+7);
        zpdj1++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+30 共"<<zhupao1+30<<endl;
        zhupao1+=30;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='2'&&rmb>=pow(2,zpdj2+9)&&zpdj2<dengji&&dengji>=4)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(2,zpdj2+8);
        zpdj2++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+30 共"<<zhupao2+30<<endl;
        zhupao2+=30;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='3'&&rmb>=pow(2,fpdj1+7)&&fpdj1<dengji&&dengji>=2)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(2,fpdj1+7);
        fpdj1++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+15 共"<<fupao1+15<<endl;
        fupao1+=15;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='4'&&rmb>=pow(2,fpdj2+9)&&fpdj2<dengji&&dengji>=3)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(2,fpdj2+9);
        fpdj2++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+15 共"<<fupao2+15<<endl;
        fupao2+=15;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='5'&&rmb>=pow(3,fpdj3+6)&&fpdj3<dengji&&dengji>=5)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(3,fpdj3+6);
        fpdj3++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+15 共"<<fupao3+15<<endl;
        fupao3+=15;
        system("pause"),system("cls");
        return ;
    }
    else if(a=='6'&&rmb>=pow(3,fpdj4+7)&&fpdj4<dengji&&dengji>=6)
    {
        system("cls");
        cout<<"升级成功\n";
        rmb-=pow(3,fpdj4+7);
        fpdj4++;
        cout<<"剩余RMB "<<rmb<<endl;
        cout<<"攻击+15 共"<<fupao4+15<<endl;
        fupao4+=15;
        system("pause"),system("cls");
        return ;
    }
    else
    {
        system("cls");
        cout<<"错误!(可能RMB不够)\n";
        system("pause"),system("cls");
        return ;
    }
}
void weixiuxitong()
{
    system("cls");
    cout<<"维修系统等级"<<xiufu<<endl;
    cout<<"每回合可回"<<xiufu*10<<"点生命"<<endl;
    cout<<"共有"<<rmb<<"RMB\n";
    cout<<"升级需要"<<dengjijg[xiufu+1]/2+500<<"RMB\n";
    cout<<"是否升级 1.是 2.否"<<endl;
    char x;
    cin>>x;
    if(x=='2')
    {
        system("cls");
        return ;
    }
    else if(x=='1'&&rmb>=dengjijg[xiufu+1]/2+500&&xiufu<dengji)
    {
        cout<<"升级成功\n"<<endl;
        rmb-=dengjijg[xiufu+1]/2+500;
        xiufu++;
        system("pause"),system("cls");
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能钱不够)\n";
        system("pause"),system("cls");
        system("cls");
        return ;
    }
}
void tuijinqi()
{
    system("cls");
    cout<<"推进器等级"<<tuijin<<"(最高六级)"<<endl;
    cout<<"逃跑几率"<<tuijin*10<<"%"<<endl;
    cout<<"共有"<<rmb<<"RMB\n";
    cout<<"升级需要"<<dengjijg[tuijin+1]/2+300<<"RMB\n";
    cout<<"是否升级 1.是 2.否"<<endl;
    char x;
    cin>>x;
    if(x=='2')
    {
        system("cls");
        return ;
    }
    else if(x=='1'&&rmb>=dengjijg[tuijin+1]/2+300&&tuijin<dengji&&tuijin<6)
    {
        cout<<"升级成功\n"<<endl;
        rmb-=dengjijg[tuijin+1]/2+300;
        tuijin++;
        system("pause"),system("cls");
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能钱不够)\n";
        system("pause"),system("cls");
        system("cls");
        return ;
    }
}
void fangyuxitong()
{
    system("cls");
    cout<<"防御系统等级"<<fangyudj<<endl;
    cout<<"共有"<<fangyu<<"点防御力"<<endl;
    cout<<"可开盾上限"<<fangyudj*5<<endl;
    cout<<"共有"<<rmb<<"RMB\n";
    cout<<"升级需要"<<dengjijg[fangyudj]*2<<"RMB\n";
    cout<<"升级可提升30点生命上限和10点防御力\n";
    cout<<"可开盾上限+5\n";
    cout<<"是否升级 1.是 2.否"<<endl;
    char x;
    cin>>x;
    if(x=='2')
    {
        system("cls");
        return ;
    }
    else if(x=='1'&&rmb>=dengjijg[fangyudj]*2&&fangyudj<dengji)
    {
        cout<<"升级成功\n"<<endl;
        rmb-=dengjijg[fangyudj]*2;
        fangyudj++;
        fangyu+=10;
        hpsx+=30;
        hp=hpsx;
        system("pause"),system("cls");
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能钱不够)\n";
        system("pause"),system("cls");
        system("cls");
        return ;
    }
}
void cangchuxitong()
{
    system("cls");
    cout<<"仓储系统等级"<<cangchudj<<endl;
    cout<<"共有最多"<<nysx<<"点能源"<<endl;
    cout<<"共有"<<rmb<<"RMB\n";
    cout<<"升级需要"<<dengjijg[cangchudj]*2<<"RMB\n";
    cout<<"升级可提升10点能源上限\n";
    cout<<"是否升级 1.是 2.否"<<endl;
    char x;
    cin>>x;
    if(x=='2')
    {
        system("cls");
        return ;
    }
    else if(x=='1'&&rmb>=dengjijg[cangchudj]*2&&cangchudj<dengji)
    {
        cout<<"升级成功\n"<<endl;
        rmb-=dengjijg[cangchudj]*2;
        cangchudj++;
        nysx+=10;
        nengyuan=nysx;
        system("pause"),system("cls");
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能钱不够)\n";
        system("pause"),system("cls");
        system("cls");
        return ;
    }
}
void yinshen()
{
    system("cls");
    cout<<"隐身系统等级"<<yincang<<endl;
    cout<<"共有"<<rmb<<"RMB\n";
    cout<<"升级需要"<<dengjijg[yincang+1]/2+300<<"RMB\n";
    cout<<"是否升级 1.是 2.否"<<endl;
    char x;
    cin>>x;
    if(x=='2')
    {
        system("cls");
        return ;
    }
    else if(x=='1'&&rmb>=dengjijg[yincang+1]/2+300&&yincang<dengji)
    {
        cout<<"升级成功\n"<<endl;
        rmb-=dengjijg[yincang+1]/2+300;
        yincang++;
        system("pause"),system("cls");
        system("cls");
        return ;
    }
    else 
    {
        cout<<"错误!(可能钱不够)\n";
        system("pause"),system("cls");
        system("cls");
        return ;
    }
}
void shengjixitong()
{
    system("cls");
    cout<<"要升级战舰的哪一部分?"<<endl;
    cout<<"其他系统等级不能高于控制室等级"<<endl;
    cout<<"1.控制室 当前等级"<<dengji<<endl;
    cout<<"2.攻击系统"<<endl;    
    cout<<"3.防御系统"<<endl;   
    cout<<"4.推进器"<<endl;    
    if(dengji>2)cout<<"5.维修系统"<<endl;
    if(dengji>2)cout<<"6.仓储系统"<<endl;
    if(dengji>3)cout<<"7.隐身系统"<<endl;
    cout<<"x.退出"<<endl; 
    char a;
    cin>>a;
    if(a=='1')kongzhishi();
    else if(a=='2')gongjixitong();
    else if(a=='3')fangyuxitong();
    else if(a=='4')tuijinqi(); 
    else if(a=='5'&&dengji>2)weixiuxitong();
    else if(a=='6'&&dengji>2)cangchuxitong();
    else if(a=='7'&&dengji>3)yinshen();
    else if(a=='x')return ;
    else 
    {
        cout<<"错误!"<<endl; 
        system("pause"),system("cls");
        shengjixitong(); 
    }
}
void zuangtai(){
    system("cls");
    cout<<"生命:"<<hp<<"/"<<hpsx<<"\n";
    cout<<"能源:"<<nengyuan<<"/"<<nysx<<"\n";
    cout<<"RMB:"<<rmb<<"\n";
    cout<<"主炮1:等级"<<zpdj1<<" 攻击力"<<zhupao1<<"\n";
    if(zpch1==0)cout<<"该炮损坏\n";
    if(dengji>=4){
        cout<<"主炮2:等级"<<zpdj2<<" 攻击力"<<zhupao2<<"\n";
        if(zpch2==0)cout<<"该炮损坏\n"; 
    }
    if(dengji>=2){
        cout<<"副炮1:等级"<<fpdj1<<" 攻击力"<<fupao1<<"\n";
        if(fpch1==0)cout<<"该炮损坏\n";
    }
    if(dengji>=3){
        cout<<"副炮2:等级"<<fpdj2<<" 攻击力"<<fupao2<<"\n";
        if(fpch2==0)cout<<"该炮损坏\n";
    }
    if(dengji>=5){
        cout<<"副炮3:等级"<<fpdj3<<" 攻击力"<<fupao3<<"\n";
        if(fpch3==0)cout<<"该炮损坏\n";
    }
    if(dengji>=6){
        cout<<"副炮4:等级"<<fpdj4<<" 攻击力"<<fupao4<<"\n";
        if(fpch4==0)cout<<"该炮损坏\n";
    }
    system("pause"),system("cls");
    return;
}
void xiufuzhanjian(){
    cout<<"一键修复战舰 需要RMB"<<dengji*50<<"\n";
    cout<<"1.修复  2.退出"<<"\n";
    char x;cin>>x;
    if(x!='1') return;
    if(rmb<dengji*50) {
        cout<<"穷鬼,没钱别来!";
        system("pause"),system("cls");
        return;
    }
    rmb-=dengji*50;
    hp=hpsx;nengyuan=nysx;
    zpch1=zpch2=fpch1=fpch2=fpch3=fpch4=1;
    cout<<"修复成功"<<"\n";
    system("pause"),system("cls");
}
signed main(){
    srand(time(0));
    init();
    while(1){
        system("cls");
        cout<<"亲爱的"<<name<<"号舰长,您要指挥战舰做什么呢?"<<"\n";
        cout<<"1.袭击其他战舰 2.升级战舰 3.修复战舰 4.星际商店 5.查看状态 6.退出游戏\n";
        char x;cin>>x;
        if(x=='1') qinlue();
        else if(x=='2') shengjixitong();
        else if(x=='3') xiufuzhanjian();
        //else if(x=='4') shangdian();
        else if(x=='5') zuangtai();
        else if(x=='6') 
        {
            system("cls");
            cout<<"是否退出?x.是\n";
            char a;
            cin>>a;
            if(a=='x')break;
        }
    }
    return 0;
}