if I understand correctly, try adding this just before your return statement in "int main()"
cin.get();
that will wait for you to review the data and press enter before exiting the program. As it is now as soon as it's done with all of it's tasks, it closes instantly.
~J