Fibonacci

I have been working on this for a long time and i just do not understand how I am supposed to do it!!!!!!!
I thought this sad bit of code up, but obviously it didnt work:


#include <iostream>

using namespace std;

int main()
{
for (int i = 1; i <= 4000000; i+=i)
{
cout << i << "\n";
}

cin.get();
return 0;
}


ANYONE! PLEASE JUST TELL ME!!!

oh ya, it would be nice if there was an explanation on the part of the code that generates the Fibonacci numbers.


Thanks.
Similar question here (I recognise the 4000000)
http://www.cplusplus.com/forum/beginner/86841/

You may find some of the code gets sets you in the right direction. And the comments by m4ster r0shi may be very relevant.
Topic archived. No new replies allowed.