Several ways to do so, here are some possible one-line approaches:
-
Use
getch()(need#include <conio.h>). -
Use
getchar()(expected for Enter, need#include <iostream>). -
Use
cin.get()(expected for Enter, need#include <iostream>). -
Use
system("pause")(need#include <iostream>, Windows only).PS: This method will also print
Press any key to continue . . .on the screen. (seems perfect choice for you :))
Edit: As discussed here, There is no completely portable solution for this. Question 19.1 of the comp.lang.c FAQ covers this in some depth, with solutions for Windows, Unix-like systems, and even MS-DOS and VMS.