How to implement “Press Any Key To Exit”

You can use the ncurses library to do this. The downside to this solution is that you won’t be able to use cout for outputting anymore.

#include <ncurses.h>
int main()
{
    initscr();
    printw("Press Any Key To Exit...");
    getch();
    endwin();
}

Be sure to -lncurses when compiling

Leave a Comment