#include<iostream.h>

#include<conio.h>

class fib

{

private:

f0, f1,fb;

public:

fib();

void increment ();

void display();

};

fib::fib()

{

f0=0;

f1=1;

fb=f0+f1;

}

fib::increment()

{

f0=f1;

f1=fb;

fb=f0+f1;

}

fib::display()

{

cout<<“Fibonacci series=”<<f0<<‘\t'<<f1<<‘\t'<<fv;

}

void main()

{

clrscr();

fib F;

F.increment();

F.display ();

getch();

}

Advertisements