fibonacci.h

来自「《IAR EWARM 嵌入式系统 编程与实践》书中例程」· C头文件 代码 · 共 34 行

H
34
字号
#include <iostream>
class fibonacci {
public:
  fibonacci()
    : current(1) {
    cout << "A fibonacci object was created." << endl;
  }

  fibonacci(int n)
    : current(n) {
    cout << "A fibonacci object that starts at fibonacci number "
         << n << " was created." << endl;
  }


  ~fibonacci() {
    cout << "A fibonacci object was destroyed." << endl;
  }


  // 函数 next
  unsigned long int next();

  // 函数 nth
  static unsigned long int nth(int nr);
protected:
  int current;

  static int initialized;
  static unsigned long int root[];

  static const int max_fib = 100;
};

⌨️ 快捷键说明

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