G'day, I've recently been teaching myself some C++ and one of the first programs I made was a Fibonacci generator, which can generate the first n numbers in the Fibonacci sequence, or calculate the nth:

I came to a problem though when n became greater than 47, which was also when the numbers generated reached 11 figures. I'm guessing there is a limit to the number of digits in an int type variable, so I changed the type to a float, but then numbers were expressed in scientific notation. I made a similar program in Python and that calculated the 10,000th number in the Fibonacci sequence in literally the blink of an eye:

So how would I do the same thing in C++?

Also, what is happening in terms of the memory when lists like this are generated? Just for reference, the code I used was:

int a = 0;
int b = 1;
int c = 0;

int n = 0;
cin >> n;
n -= n;

for (i = 0; i != n; i++){
    a = b;
    b = c;
    c = a + b;
    cout << c << endl;
Is the variable c allocated a new slot in the memory each time the program is iterated, so that all previous print outs of c are still visible, or is the memory overwritten and the previous versions of c stored by the console? I was monitoring my memory usage while generating a list of the first 500,000 numbers in the Fibonacci sequence, and it didn't seem to go up. Is that because 500,000 integers is still a negligible amount when you have 8GB of RAM?

On a side note, to stop the program from closing when it finished, I used cin.get() right at the end, but I had to use it at the end of all the if statements as well in order for it to actually work. So instead, right at the end I used:

string k = ' ';
cin >> k;
This is more compact, but it seems messy and unnecessary. What would be a good alternative?