-
pause
Ok, i created a hello world kinda thing and i wanted to try to add sum more strings.... how can i make the hello world pause because the only way i can veiw it at the moment is open a dos prompt. just running the .exe in windows.... it opens and closes real fast, im sure u expert C++ pll know what im talking about... hell im sure newbies that have made a hello program knows.. but anyways, whats the string i add to pause the window from closing when i open it. thanks
-
there's getch(), getche(), getchar(), system("PAUSE") other means to do that.
discussed often here. search for any of them for more detailed info or search your own compiler help.
-
Code:
#include <iostream>
int main()
{
std::cout<<"Hello, World!\n";
std::cin.get();
return 0;
}
-Prelude
-
Prelude: Just curious, why do you use the std::? Isn't it easier to put using namespace std at the top?
-
>Isn't it easier to put using namespace std at the top?
Of course it's easier and certainly more convenient for the person writing the code. But is it safe? Is it secure? Can you guarantee that if you answered yes to either?
Having a whole bunch of unnecessary clutter in the global scope has been repeatedly proven to be a mistake, so you should only do so if you have a very good reason. Convenience is rarely a good enough reason, so I restrict my code to local scopes as much as possible to avoid unforseen complications.
-Prelude