First, you don't want your instructor to know that you simply copied the code from
this web page. Getting
assistance by using the page is one thing.... basically plagiarizing the code is another altogether. However, the output
is correct, and the program does work.
The reason it is likely "just closing" is because you are running this through a GUI of some kind, that launches the code, and exits (hence, closing the otuput window). You can run this through a command line, or put a
cin.ignore() just before the return 0; (which you don't have, but should have as the last line before the ending }). If one cin.ignore() doesn't work, try two.
Last edited by Comatose; Feb 10th, 2009 at 1:41 pm.
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Offline 2,413 posts
since Dec 2004