⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gballoonx.h

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 H
字号:
#ifndef _GBALLOON_H
#define _GBALLOON_H

// class for balloon manipulation using simulated auto pilot
// (based on an idea of Dave Reed) graphics version 3/22/99
//
// Ascend: rise to specified height in a sequence of burns
//         Each burn raises the altitude by 10 meters
//
// Cruise: cruise for specified time-steps/seconds
//         Random wind-shear can cause balloon to rise and fall,
//         but vents and burns keep ballon within 5 m. of start altitude
//
// Descend:   descend to specified height in sequence of vents
//            Each vent drops the balloon 10 m. or to ground if < 10 m.
//
// int GetAltitude: returns altitude (in meters)  (y-coord)
// int GetLocation: returns how many time steps/secs elapsed (x-coord)

#include "canvas.h"
#include "utils.h"

class Balloon
{
  public:
    Balloon();                    // use default color (gold)
    Balloon(color c);             // balloon of specified color
    
    void Ascend  (int height);    // ascend so altitude >= parameter 
    void Descend (int height);    // descend so altitude <= parameter 
    void Cruise  (int steps);     // cruise for parameter time-steps 
    int GetAltitude() const;      // returns height above ground (y-coord)
    int GetLocation() const;      // returns # time-steps (x-coord)
  private:
    void Burn();
    void Vent();
    int myAltitude;
    int mySteps;        // ... see gballoon.h for details
};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -