View Single Post
  #2 (permalink)  
Old July 9th, 2008, 05:29 PM
iceman90289 iceman90289 is offline
Friend of Wrox
 
Join Date: Mar 2008
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

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.

Reply With Quote