Program Fibonaci C++

First let's look more closely at what is on the Fibonacci numbers. Fibonacci sequence is as follows:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
This sequence leads to a certain ratio is constant and that does not make sense, he represents a number that does not end, the sequence of decimal numbers that can not be expected that can not be expressed appropriately or in words .. please understand and be understood. This program may be a bit can help.

    # include
    # include

    class array {
        friend ostream & operator <<(ostream &, array &);
        friend istream & operator>> (istream &, array &);

    public:
        series ();
        void yield () {
          court <<"Fibonacci Numbers <" <<<": \ n0, 1";
          f1 = 0; f2 = 1;
          while (true) {
           f3 = f2 + f1;
           if (f3> limit) break;
           <<","<< int f3;
           f1 = f2;
           f2 = f3;
           };}

    private:
        long boundary, f1, f2, f3;
        };

    sequence:: sequence () {
        court <<"Program Fibonaci C++" <
        court <
        }

    istream & operator>> (istream & ins, series & entry) {
        court <<"Enter a positive number:";
        in>> masuk.batas;
        return in;
        }

    ostream & operator <<(ostream & out, the series & metu) {
        return out;
        }

    main () {
    array x;
    cin>> x;
    x.hasil ();
    court <

    getch ();
    return 0;
    }


0 comments:

Twitter Delicious Facebook Digg Favorites More