I'm new to C++. I was messing around creating a simple program that took the two numbers you inputted and displayed the answer. The only problem was that it closed too fast. I decided to do what I usually do and and a cin.get();
and it usually solves the problem. The weird thing is, this time it didn't. I had to put two cin.get();
statements. I'm curious to why it requires me to put two for it to stay open instead of the usual one. Here is my code:
int a;
cin >> a;
int b;
cin >> b;
cout << a + b;
cin.get();
cin.get();