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