Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created May 6, 2014 04:22
Show Gist options
  • Save jerstlouis/95230c50a09c9ea7da45 to your computer and use it in GitHub Desktop.
Save jerstlouis/95230c50a09c9ea7da45 to your computer and use it in GitHub Desktop.
void TestFibonacci()
{
Fibonacci fibonacci { };
Iterator<uint64> i { fibonacci };
int c;
//while(i.Next())
while(i.Prev())
{
PrintLn(i.data);
}
for(c = 0; c<10; c++)
{
i.Index(c, false);
PrintLn(i.data);
}
if(i.Find(233))
{
Print(i.data, " is a Fibonacci number, next is ");
i.Next();
PrintLn(i.data);
}
if(i.Find(145))
PrintLn(i.data, " is a Fibonacci number");
i.Free();
delete fibonacci;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment