I have written this code to calculate the nth number in a Fibonacci Sequence. However once I debug the code and enter a value, the box disappears. Does anyone have any idea why?
using namespace std;
int x, i, j, n, m;
cout <<"Enter the total number \n";
cout <<"Total number of the series is \n"<< n;
cout <<"\n" << i << "\n" << j;
After this instruction cin >>n; there is a newline character remaining in the input buffer.
The cin.get(); statement will retrieve that newline, and the program continues. if you want the program to wait, add a second cin.get(); after that.
As you can see from previous suggestions, there are many ways to solve this, it's a very common problem, which is why there is a sticky thread titled "Console Closing Down" at the top of the page: http://www.cplusplus.com/forum/beginner/1988/