#include <iostream>
#include <windows.h>
namespace console {
void pause() {
DWORD mode;
HANDLE hin;
INPUT_RECORD inrec;
DWORD count;
// Instruct the user
std::cout << "Press the 'any' key...";
// Set the console mode to no-echo, raw input,
// and no window or mouse events.
hin = GetStdHandle( STD_INPUT_HANDLE );
GetConsoleMode( hin, &mode );
SetConsoleMode( hin, 0 );
// Wait for and get a single key press
do ReadConsoleInput( hin, &inrec, 1, &count );
while (inrec.EventType != KEY_EVENT);
// Restore the original console mode
SetConsoleMode( hin, mode );
}
}