跳到正文

个人记录

飞机模拟器

Furina_Aurora约 4 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年1月3日
篇幅
约 4 分钟

版本

  1. v1当前

主代码

C++
#include<bits/stdc++.h>
using namespace std;
struct plane{
    double slope,high,speed,uppre,dwpre,plefrun1,prigrun1,plefrun2,prigrun2,ll,rl;
    //  斜度  高度  速度  上气压 下气压 左机1压   右机1压  左机2压  右机2压
    bool riw,lfw,flap,t,tail,head,dwjia;
    //  左右机翼  襟翼 状态 尾部 头部 起落架
    double lwh,rwh,lfh,rfh,th,hh;
    //  左、右机翼 左、右襟翼 头部 尾部(受损程度)
    string plane_name;
    //飞机名称
    double getl(){return ll;}
    double getr(){return rl;}
    double getSlope(){return slope;}
    double gethigh(){return high;}
    double getspeed(){return speed;}
    double getuppre(){return uppre;}
    double getdwpre(){return dwpre;}
    double getfrun(int id){
        if(id==1) return plefrun1;
        else if(id==2) return plefrun2;
        else return 0.0;
    }
    double getgrun(int id){
        if(id==1) return prigrun1;
        else if(id==2) return prigrun2;
        else return 0.0;
    }
    bool has_lwh(){return lwh;}
    bool has_rwh(){return rwh;}
    bool has_flap(){return flap;}
    bool has_head(){return head;}
    bool has_tail(){return tail;}
    double getHerat(int typ){
        if(typ==1) return lwh;
        else if(typ==2) return rwh;
        else if(typ==3){
            double ans=(lfh+rfh)/2;
            return ans;
        }
        else if(typ==4) return th;
        else if(typ==5) return hh;
    }
    void getName(string pn){plane_name=pn;}
    void goHigh(double hl){high+=hl;}
    void goslo(double hl){slope+=hl;}
    void gospeed(double hl){speed+=hl;}
    void warning(){
        if(speed>=565 && (ll>rl||rl>ll)) cout<<"pull up!"<<'\n';
        else if(speed==0 && (high<100 && high>0) && dwjia==false) cout<<"Ground!"<<'\n';
        else if(slope>=90) cout<<" BIG Elevation!"<<'\n';
        //bool riw,lfw,flap,t,tail,head;
        else if(riw==false||lfw==false||flap==false||tail==false||head==false){
            cout<<"Plane crash!"<<'\n';
        }
    }
}p;
signed main(){
    //正准备开发此部分
    return 0;
}

欢迎各位继续完善主函数部分

原文