mirror of
https://github.com/ENSL/NS.git
synced 2024-11-24 13:31:12 +00:00
2f9f0c732e
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@277 67975925-1194-0748-b3d5-c16f83f1a3a1
21 lines
290 B
C++
21 lines
290 B
C++
#ifndef _fib_h
|
|
#define _fib_h
|
|
class Fibonacci
|
|
{
|
|
public:
|
|
Fibonacci() : v1(0), v2(1) {}
|
|
inline int operator()();
|
|
private:
|
|
int v1;
|
|
int v2;
|
|
};
|
|
|
|
inline int
|
|
Fibonacci::operator()()
|
|
{
|
|
int r = v1 + v2;
|
|
v1 = v2;
|
|
v2 = r;
|
|
return v1;
|
|
}
|
|
#endif // _fib_h
|