猫咪帝国居民建设版

· · 个人记录

#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
void xitongout();
void maomidiguoout();
void clean();
void jianzao();
void shengli();
void shibai();
unsigned long long maobohe=0;
unsigned long long maobohetian=0;
unsigned long long mutou=0;
unsigned long long fangzi=0;
unsigned long long fangzikeyizhudemao=0;
unsigned long long a;
bool f=0;
int main(){
    xitongout();
    if(a==0){
        shengli();
        return 0;
    }
    while(true){
        maomidiguoout();
        jianzao();
        if(f==1){
            shengli();
            break; 
        }
    }
    return 0;
}
void clean(){
    system("cls");
    return ;
}
void shengli(){
    Sleep(1000);
    clean();
    cout<<"恭";
    Sleep(100);
    cout<<"喜";
    Sleep(100);
    cout<<"通";
    Sleep(100);
    cout<<"关";
    Sleep(100);
    cout<<"!"<<endl;
    return ;
}
void shibai(){
    Sleep(1000);
    clean();
    cout<<"恭";
    Sleep(100);
    cout<<"喜";
    Sleep(100);
    cout<<"失";
    Sleep(100);
    cout<<"败";
    Sleep(100);
    cout<<"!"<<endl;
    exit(0);
}
void jianzao(){
    int x;
    cout<<"收集猫薄荷按1"<<endl;
    cout<<"出售猫薄荷田按2,建造猫薄荷田按3"<<endl;
    cout<<"提炼木头按4,出售木头按5"<<endl;
    cout<<"建造房子按6,出售房子按7"<<endl;
    cout<<"_____________"<<endl; 
    cin>>x;
    if(x==1){
        maobohe++;
    }
    else if(x==2){
        if(maobohetian>0){
            maobohetian--;
            maobohe+=50;
        }
    }
    else if(x==3){
        if(maobohe>=100){
            maobohetian++;
            maobohe-=100;
        }
    }
    else if(x==4){
        if(maobohe>=1000){
            mutou++;
            maobohe-=1000;
        }
    }
    else if(x==5){
        if(mutou>0){
            mutou--;
            maobohe+=500;
        }
    }
    else if(x==6){
        if(mutou>=100){
            fangzi++;
            fangzikeyizhudemao+=2;
            mutou-=100;
        }
    }
    else if(x==7){
        if(fangzi>0){
            fangzi--;
            fangzikeyizhudemao-=2;
            mutou++;
        }
    }
    return ;
}
void maomidiguoout(){
    Sleep(100);
    clean(); 
    cout<<"_____________"<<endl; 
    maobohe+=(maobohetian*5);
    maobohe-=(fangzikeyizhudemao*100); 
    if(maobohe<0){
        shibai();
    }
    cout<<"猫薄荷:"<<maobohe<<endl; 
    cout<<"猫薄荷田:"<<maobohetian<<endl;
    cout<<"木头:"<<mutou<<endl;
    cout<<"房子:"<<fangzi<<endl;
    cout<<"房子可以住的猫:"<<fangzikeyizhudemao<<endl; 
    if(fangzikeyizhudemao>=a){
        f=1;
    }
    cout<<"_____________"<<endl;
    return ;
}
void xitongout(){
    cout<<"欢";
    Sleep(100);
    cout<<"迎";
    Sleep(100);
    cout<<"来";
    Sleep(100);
    cout<<"到";
    Sleep(100);
    cout<<"猫";
    Sleep(100);
    cout<<"咪";
    Sleep(100);
    cout<<"帝";
    Sleep(100);
    cout<<"国";
    Sleep(100);
    cout<<"居";
    Sleep(100);
    cout<<"民";
    Sleep(100);
    cout<<"建";
    Sleep(100);
    cout<<"设";
    Sleep(100);
    cout<<"版";
    Sleep(100);
    cout<<"!"<<endl; 
    Sleep(1000);
    clean();
    cout<<"你";
    Sleep(100);
    cout<<"的";
    Sleep(100);
    cout<<"任";
    Sleep(100);
    cout<<"务";
    Sleep(100);
    cout<<"是";
    Sleep(100);
    cout<<"房子可以住的猫";
    Sleep(100);
    cout<<"达到";
    Sleep(100);
    cout<<"a";
    Sleep(100);
    cout<<"!"<<endl;
    Sleep(100); 
    cin>>a; 
    return ;
}