First, you should have a return statement in main(). Here is the program template all beginners should use:
Code:
#include <iostream>
using namespace std;
int main()
{
//your code here
return 0;
}
That would probably make it more obvious what is wrong with your program: your cin.get() is outside of main(), so it is never executed.
Code:
int main()
{
}
cin.get();
Your program is executed line by line starting at the top of main() and works sequentially downward. When you call a function, that causes execution to be transferred to the function. When the function finishes executing, execution is transferred back to main(). After all the lines of code in main() have been executed, the closing parenthesis in main() is encountered. When that happens, there is an implicit return statement:
return 0;
which causes your program to terminate execution. However, you should make that return statement explicit by including it in your program as the last line of main().