I am looking for a function that will pause the screen and prompt the user to "Press any key to continue.." that will work on the g++ compiler. In MSVC system("pause") works just fine, however, g++ doesn't like that at all. Is there a comparable function for use with the g++ compiler. I've tried writing my own, but have had mixed success. This is the function I wrote myself, however, the screen has a tendency to require the user to hit "Enter" only, and sometimes requires it twice depending on the output previous to invoking the function call.
cout << "\nPress the Enter key to continue....\n";
Any help would be greatly appreciated! If there is an internal/built in function, that would be better yet.