Source of pause.cpp


  1: // Filename: PAUSE.CPP
  2: // Purpose:  Causes a function to pause and wait for a user response.

  4: #ifndef PAUSE_CPP
  5: #define PAUSE_CPP

  7: #include <iostream>
  8: #include <iomanip>
  9: using namespace std;

 11: //******************************************************************
 12: void Pause(/* in */ int indentLevel)
 13: // Pre:  indentLevel has been initialized.
 14: //       The input stream cin is empty.
 15: // Post: The program has paused and displayed a one-line message
 16: //       indented indentLevel spaces, after which the user has
 17: //       pressed the Return or Enter key.
 18: {
 19:     cout << setw(indentLevel) << ""
 20:          << "Press return to continue ... ";
 21:     char returnChar;
 22:     cin.get(returnChar);
 23:     cout << endl;
 24: }

 26: #endif