In windows when compiling, system("pause") works, what is the equivalent in linux?

1 Answer

The following works on windows and linux/unix:

std::cout << "Press \'Return\' to end." << std::endl; std::cin.flush(); std::cin.get(); 

The first std::cin.flush() clears the input que, the next command waits for an input.

3