Pause Command in C++ Last Updated : 16 Aug, 2022 Comments Improve Suggest changes Like Article Like Report pause() is a C++ method used to pause a program during execution. It allows the user to input or read data. The pause approach makes the system more readable and user-friendly by allowing the user to read the instructions before performing any task. What is pause()?The pause() function is used to pause the execution of the current program and wait for the user to press the enter key to terminate its operation. It serves the purpose of pausing the program, as its name implies. This method is window-specific. Only the Windows Operating System and earlier compilers like DOS support it. It can suspend a running program. To terminate the pause () method, the user can press enter or provide some time. When the pause method completes its operation, the remaining program starts to execute. Features: Window specificSupported by the older compilerFast and EfficientSyntax: system("pause") Here, system() is a function that calls the operating system to perform the passed task. This method is present inside the <cstdlib> header file. It invokes Windows operating system to run the pause() function. Return Type: The pause method has no return type. Parameters: There are no parameters in the pause () function. Users can set a timer to automatically end the program in milliseconds. Note: 1. Run pause() code on windows only.2. The code can also be executed on MS-DOS compiler.3. Modern Compiler won't support this method it throws a command not found error. Example 1: Below is the C++ program that will display messages with the pause method. C++ // C++ program to pause program // using pause() method #include <iostream> #include <cstdlib> using namespace std; // Driver code int main() { cout << "Welcome To Geeksforgeek "; system("pause"); cout << "Done"; } Output: Welcome To Geeksforgeek Press any key to continue….. DoneExample 2: Below is the C++ program to print 1 to 10 numbers. C++ // C++ program to print // 1 to 10 numbers #include <iostream> #include <cstdlib> using namespace std; // Driver code int main() { for (int i = 1; i <= 10; i += 2) { cout << "i = " << i << endl; if (i == 5) { // Call the pause command cout << "Program Is Paused\n"<< endl; system("pause"); cout << "Terminated\n"; } } cout << "Done\n" << endl; return 0; } Output: i = 1 i = 3 i = 5 Program Is Paused Press any key to continue….. Terminated i = 7 i = 9 DoneAdvantages: Users can easily remember this method. It is useful to pause programs in older compilers like MS-DOS. To pause programs in the Windows system. The user can pause the program for as long as he wants by passing the time limit.Disadvantages: The pause() function is not portable and is platform-specific. As the pause () method is window-specific, it will not work on other operating systems like Unix, Linux, etc.When the user calls the pause method, he also calls the system function. which all takes extra memory The remaining program will not execute until the pause () method is terminated or the user presses Enter.It's slow. It's insecure. Comment More infoAdvertise with us Next Article Pause Command in C++ R reshmapatil2772 Follow Improve Article Tags : C++ Practice Tags : CPP Similar Reads Sleep Function in C++ C++ provides the functionality of delay or inactive state of the program with the help of the operating system for a specific period of time. Other CPU operations will function adequately but the sleep() function in C++ will sleep the present executable for the specified time by the thread.The sleep 3 min read continue Statement in C++ C++ continue statement is a loop control statement that forces the program control to execute the next iteration of the loop. As a result, the code inside the loop following the continue statement will be skipped and the next iteration of the loop will begin. Syntax: continue;Flowchart of continue S 5 min read Signal Handling in C++ Signals are the interrupts that force an OS to stop its ongoing task and attend the task for which the interrupt has been sent. These interrupts can pause service in any program of an OS. Similarly, C++ also offers various signals which it can catch and process in a program. Each signal has its own 4 min read C++ Wait for User Input Waiting for User input is common functionality in any program requiring some form of user intervention. Whether it is halting the execution to see the output produced, or is it for taking in user input, halting the execution for input is one of the most common tasks that are performed by a program. 4 min read Mutex in C++ Mutex stands for Mutual Exclusion. In C++, std::mutex class is a synchronization primitive that is used to protect the shared data from being accessed by multiple threads simultaneously. The shared data can be in the form of variables, data structures, etc. std::mutex class implements mutex in C++. 4 min read goto Statement in C++ The goto statement in C++ is a control flow statement that provides for an unconditional jump to the same function's predefined label statement. In simple terms, the goto is a jump statement transfers the control flow of a program to a labeled statement within the scope of the same function, breakin 5 min read kbhit in C language kbhit() functionality is basically stand for the Keyboard Hit. This function is deals with keyboard pressing kbhit() is present in conio.h and used to determine if a key has been pressed or not. To use kbhit function in your program you should include the header file "conio.h". If a key has been pre 2 min read queue push() and pop() in C++ STL The std::queue::push() and std::queue::pop() functions in C++ STL are used to push the element at the back of the queue and remove the element from the front of the queue respectively. They are the member functions of the std::queue container defined inside the <queue> header file.In this arti 2 min read How to Use usleep Function in C++ Programs? Halting the program's execution at the desired time for a specific duration is one of the most used features in a programming language. This is generally done to provide some time for input or multithreading. This article will teach you how to use the usleep function to halt the program execution in 2 min read Like