weatherprediction.h

来自「C++高级编程这本书所附的源代码」· C头文件 代码 · 共 37 行

H
37
字号
// WeatherPrediction.h

/**
 * Predicts the weather using proven new-age
 * techniques given the current temperature
 * and the distance from Jupiter to Mars. If
 * these values are not provided, a guess is
 * still given but it's only 99% accurate.
 */
class WeatherPrediction
{
 public:
  virtual void setCurrentTempFahrenheit(int inTemp);
  virtual void setPositionOfJupiter(int inDistanceFromMars);

  /**
   * Gets the prediction for tomorrow's temperature.
   */
  virtual int getTomorrowTempFahrenheit();

  /**
   * Gets the probability of rain tomorrow. 1 means
   * definite rain. 0 means no chance of rain.
   */
  virtual double getChanceOfRain();

  /**
   * Displays the result to the user in this format:
   * Result: x.xx chance. Temp. xx
   */
  virtual void showResult();

 protected:
  int mCurrentTempFahrenheit;
  int mDistanceFromMars;
};

⌨️ 快捷键说明

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