Sebastiani's link looks like it has some good information in it.. for quick reference here is how you can fix the specific problem:
Code:
#include <iostream.h>
int main()
{
int a,b,c,sum;
cout <<"\nWelcome. This program adds\n";
cout <<"three numbers. Enter three numbers\n";
cin >>a>>b>>c;
sum = a+b+c;
cout <<"The sum is: " << sum << "\n";
cin.ignore();
cin.get();
return 0;
}
The reason is that when you extract a, b, and c from the input stream, the newline from when you hit enter is still there. The cin.get() waits for the next newline, but since there is already one there your console closes. The call to cin.ignore() above fixes that specific problem by ignoring that first newline and allowing the cin.get() to wait for the next one. You could also put cin.get() twice or cin.ignore() twice to achieve the same effect.
I'd prefer this code, because making that simple change above still leaves many potential problems.
Code:
#include <iostream>
#include <limits>
int main()
{
int a,b,c,sum;
std::cout <<"\nWelcome. This program adds\n";
std::cout <<"three numbers. Enter three numbers\n";
std::cin >> a >> b >> c;
sum = a+b+c;
std::cout <<"The sum is: " << sum << "\n";
std::cin.ignore(std::numeric_limits<int>::max(), '\n');
std::cin.get();
return 0;
}
That uses standard headers, and it ignores all characters in the input stream - which helps in case the user accidentally types in characters after the last number. There are several other error-prrofing things you could do, but that is a start.