I'm programming in C++ and I've created this small program...it gives you 4 options...but whenver I select one of them...it gives the result and then automatically closes!! The other programs I made don't work like this..but this one keeps on closing...is there any way to stop this automatic closing?? Help will be greatly appreciated.
The C++ Program closes once I chose a selection! :((?
if you are using programing in win32 console(dos) projects
put this command at the end
system("PAUSE");
thats only if you using windows
after excuting the program jumps to system(0) so it exits automacailly.
Reply:just put this line getch() in each of the cases,it will wait for any key to be pressed before exiting..
switch(input)
{
case 1:
lines you want to enter...
..................................
...................
getch();
case 2:
lines you want to enter...
..................................
...................
getch();
and so on..
sorry if i made any mistake in the syntax ( i know the getch syntax is correct :) ) otherwise..been a long time since i worked with C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment