Tuesday, July 28, 2009

C++ system("pause");?

every time i try and use a website tutorial for c++ they tell me to use system("pause"); but every time i use it, it gives me an error, but if i use cin.get(); it ususally works(not all the time though). how do i get system("pause"); to work? here is a sample program that wont work on the account of system("pause");.





#include %26lt;iostream%26gt;





using namespace std;





int main(){








cout %26lt;%26lt; "Hello World!\n";


system("pause");





return 1;





}

C++ system("pause");?
Does something like this help:





http://cpp.codenewbie.com/articles/cpp/1...





If you need to manually "restart" the program, that site will work. Otherwise you can just Sleep(5000) if it's a 5 second timed pause (just change 5000 to whatever).
Reply:#include %26lt;iostream%26gt;


#include %26lt;conio.h%26gt;





using namespace std;





int main(){








cout %26lt;%26lt; "Hello World!\n";


getch();





return 1;





}





ive been using that on C a long time ago.. it will continue if you press any key..
Reply:Isn't "pause" a DOS command? What OS are you running?


No comments:

Post a Comment