Hi,
I have made a small program and have added system("pause");
at the end of the program file.
I wanted to know that is it necessary that we should add this "system("pause"); at the end of a program?
When do we actually have to use this?
Thanks
Printable View
Hi,
I have made a small program and have added system("pause");
at the end of the program file.
I wanted to know that is it necessary that we should add this "system("pause"); at the end of a program?
When do we actually have to use this?
Thanks
It isn't.Quote:
Originally Posted by student111
Never, except in the special case when you actually have to invoke a "pause" command for some exceedingly special reason, in which case you won't need to ask because you already know. Refer to this article on keeping the console window open.Quote:
Originally Posted by student111
I prefer using:
It's an extra line of code, but it avoids using system commands.Code:std::cin.ignore(); //ignores any information currently waiting to be gathered such as enters etc
std::cin.get(); //requests user input. This will pause your program