Thread: Golden Ratio

  1. #1
    Registered User
    Join Date
    May 2004

    Golden Ratio


    I have to draw a spiral in my console window using the Fibonacci numbers.
    I have to use a 2D array and plot in the values.

    I have this algorithim which finds the values but I don't think this is enough. I need to find the values so I can draw the dots and make up the spiral.

    #include <iostream>
    #include <string>
    using namespace std;
    static const int n=20;
    class ratio
            ratio(int a):result(a==0?0:a==1?1:ratio(a-1)+ratio(a-2))
                { /* empty */ }
        public:operator int(){return result;}
        private:int result;
        int main()
            for(int a=0;a<n;a++)
            //cout <<"\n Golden Ratio("<<a<<")\t"<< ratio(a);
            cout << ratio(a) << "\n";
            return 0;

  2. #2
    Registered User
    Join Date
    Mar 2002
    You will probably want to look into use of a graphics library to go with your protocol. Consoles are line by line displays. You could declare a large char array with space char to represent no data point and some other char to represent data point and print out line by line using ASCII text, but I doubt that's what you had in mind. There are a number of graphics libraries available. A search of the board may you give you some places to go, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem aligning floating point numbers
    By esbo in forum C Programming
    Replies: 4
    Last Post: 01-05-2009, 08:09 PM
  2. 2:1 Aspect Ratio
    By Wraithan in forum Game Programming
    Replies: 6
    Last Post: 02-09-2006, 02:17 AM
  3. Memory Hit Ratio
    By MB1 in forum Tech Board
    Replies: 2
    Last Post: 12-03-2005, 02:46 PM
  4. Golden Section Search--When to use it?
    By just2peachy in forum C++ Programming
    Replies: 4
    Last Post: 10-08-2004, 11:47 AM
  5. REgarding Golden Bunny / Ruflano
    By Aran in forum A Brief History of
    Replies: 5
    Last Post: 05-18-2002, 12:49 AM