VOOZH about

URL: https://www.geeksforgeeks.org/cpp/how-to-pause-a-program-in-cpp/

⇱ How to Pause a Program in C++? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Pause a Program in C++?

Last Updated : 23 Jul, 2025

Pausing programs in C ++ is an important common task with many possible causes like debugging, waiting for user input, and providing short delays between multiple operations. In this article, we will learn how to pause a program in C++.

Pause Console in a C++ Program

We can use the std::cin::get() method to pause the program's execution until the user provides the input. This function works by extracting a single character from the input stream, effectively causing the program to wait until the next keystroke is pressed and then the program continues with its normal execution.

Syntax to Use std::get Function

cin.get();

C++ Program to Pause a Program Execution in C++

The below program demonstrates how we can pause a program until the user provides input in C++.


Output

Your Program is paused! To continue, Press Enter.

Continuing...Wait for a While
Program resumed after user input.

Time Complexity: O(1)
Auxilliary Space: O(1)

Comment