   really basic question!
  I should expect this is a really really easy question as Ive literally just started learning c++ using dev-c++. Trying some basic hello world things, whenever I run the file though, the dos windows appears for only a slpit second... what do you have to put in to make it stay open? Or does this only happen once you enter more commands... such as hit enter to continue?   
  Simply wait for user input ( the cin object ) or use system("PAUSE");I have heard the latter is a really ugly way of doing things so I'd just wait for user input...One thing though, normally, you would open up a console and execute your program from there. If you do it that way you don't have to wait for user input because the console window remains open...   ;  What do you mean by open up a console? I just run it from Dev-c++ at the moment.   ;  As stated above, you can use system("PAUSE");, but i will show you two ways of doing what you want.system("PAUSE");#include <iostream>using namespace std;int main(){ cout << "Hello Word!" << endl << endl; system("PAUSE"); // wats for user to press a key return 0;}Using cin.get():#include <iostream>using namespace std;int main(){ cout << "Hello Word!" << endl << endl; cout << "Press Enter to exit!"; // make any message you want cin.get(); // waits for user to press enter return 0;}- Hope that helps [smile]   ;  Start->Run "cmd.exe"Then just navigate to your project's binary directory using the "cd"-command inside the console window.It's pretty simple actually [smile]   ;  Ah right sorry im with ya now!! >.< Had one of those moments there...And thanks guys! Can get on with it now!   ;  ye, this is a bad thing in devcppi prefer this#include <stdio>int number;int main(){ printf("Hello Word!Write number please!\n"); scanf("%d",&number);  //store number return 0;};  In my opinion, one of the smallest, and easiest ways to do this is with get char. system("PAUSE") sends out a message you may not want, cin.get() waits for enter... and so does scanf. getch() waits for you to press a key, and doesn't even echo it. You can use getche() if you do want an echo, however. Also it's defined in conio.h, so be sure to include that.-Etyrn   ;Quote:Original post by EtyrnIn my opinion, one of the smallest, and easiest ways to do this is with get char. system("PAUSE") sends out a message you may not want, cin.get() waits for enter... and so does scanf. getch() waits for you to press a key, and doesn't even echo it. You can use getche() if you do want an echo, however. Also it's defined in conio.h, so be sure to include that.-EtyrnThere is a conio.h in devcpp?mikecooper, please remember that pausing a console program is a temporary hack. The goal is to allow you to see what really happens. Console programs are supposed to be launched from the console, and in this case pausing is not required. Another way to pause your program at the end without poluting it with any kind of "I want you to hit a key" method is to put a breakpoint at the end of your program (on the closing } or main()). You have to compile a debug version to be able to do this. Regards,   ;Quote:Original post by Etyrnsystem("PAUSE") sends out a message you may not wantIf it comes down to it, this message is customizable.  Simply write:system("ECHO I want this message displayed instead of the default one");system("PAUSE>NUL");It probably doesn't matter in this case, but I just wanted to throw that out there for anyone who might like to know.-AJ   