Golden Ratio

This is a discussion on Golden Ratio within the C++ Programming forums, part of the General Programming Boards category; hey, I have to draw a spiral in my console window using the Fibonacci numbers. I have to use a ...

  1. #1
    mas
    mas is offline
    Registered User
    Join Date
    May 2004
    Posts
    1

    Golden Ratio

    hey,

    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.

    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    static const int n=20;
    
    class ratio
        {
        public:
            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;
        }
    thanks,mas

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    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, 12:47 PM
  5. REgarding Golden Bunny / Ruflano
    By Aran in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 05-18-2002, 01:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21