the problem is simple. look at the end of your main function. there is basically a cout statement nested in an if-then-else statement. you need to add this before the closing bracket in main:
while(true)
{
}
this keeps your program running. if you want, you can use system("PAUSE");
what its doing is ending because all instructions are already executed, when you call a function, program flow moves down that function, and at the end of the function it goes back to where it was called and the same applies to main, once the program flow reaches "return 0" in your main function, your program is considered over.
|