using the dev-c++ compiler by bloodshed- (I'm new to programming) when I code a basic hello world program and click compile it compiles but there's no window that pops up and displays the output with "hello world" in it? So I thought I should click the "run" button and it seemed to bring up a small "output looking" window, but only for a split second.. then it disappears... it doesnt stay long enough for me to notice the words "hello world"... does anyone know how I get this window to stay instead of disappearing?
You can select Start: Run: "cmd", then run the program from the command line. Alternatively, you can use cin to get input.
thanks wingedpanther- that's twice you've tried to assist- appreciate itBut unfortunately, when I run it from the command line the behavior is the exact same- the window just briefly flashes... apparently it's supposed to disappear and I just havnt learned why yet.. on a side note when I set out to learn c++ I was prepared to be challenged learning the language... I had absolutely no idea the compilers them selves would be such a challenge too. oh well. suck it up, right lol.
No. You have to actually launch the program from the command prompt.
that means I have to know the basics of dos right? if I understand you, you're saying I have to basically somehow get "c:\" to show up in the window- then type out the path to the .exe, then hit enter to run it? is that what you wanted me to do?
I typed "cmd" in the run box.. it brought up what I think is the comand prompt window.... the default directory was "c:\documents and settings \administrator>
so after the ">" I typed the name of the .exe (because it's in the documents and settings directory).. it said in return: "untitled.exe" is not recognized as an internal or external command... I guess it's a syntax error?
You're right, but you have to be in the folder where the .exe is located. You can type "dir" to get a list of files, and "cd" to change directories. "cd.." goes to the parent, "cd [folder]" goes into the folder.
If your on windows, you could just simply add
this would allow you to use the windows command called "pause" which you can see is system("pause");Code:#include <iostream> #include <windows.h> using namespace std; int main() { cout << "Hello World" << endl; system("pause"); return 0; }
and now it would pause the prompt without exiting....
note: #include <windows.h> allows you to have acces to the windows functions
Killcode got the right idea. if you tried WP's way to run it through the command prompt you would need to follow these steps.
Compile the program
Open CMD
Go to the directory its located in, (eg. cd C:\\Users\Nick\Desktop\program.exe)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks