Computer Forums

Computer Forums (http://www.computerforums.org/forums/)
-   Programming (http://www.computerforums.org/forums/programming/)
-   -   Dev C++ help (http://www.computerforums.org/forums/programming/dev-c-help-119330.html)

Syn7ax 3rror 04-02-2005 10:47 PM

Dev C++ help
 
Hello all. i just installed Dev C++ and tried to compile a program. But, when I hit "run", a window just flashed up for a milisecond then went away. Please tell me what I am doing wrong. It linked and compiled correctly and has no bugs.

UK31337 04-03-2005 06:55 AM

Chances are you're not doing anything wrong.

Add the following line to the end of your program:

Code:

system("pause");
Put it just before the final closing brace in int main()

You'll then see your window stay open and it'll say "Press any key to continue..." instead of just exiting.

To get around this problem without that extra code, just open up Command Prompt, navigate to the directory that contains your exe, and run it from there. The window won't close after you run the program.

Syn7ax 3rror 04-03-2005 10:20 AM

Ahhhh. Thanks alot. If I want to open the cursor, where is it located.

Syn7ax 3rror 04-03-2005 10:55 AM

Ok heres what I got

code:

#include <iostream>

int main()
{
std::cout << "Hello World/n;"
;return 0;
system("PAUSE");

}

But when I complie it says done but when I hit run it syas "Project not compiled. I did a compile and run in one step and the cursor still flashed. Please help.

UK31337 04-03-2005 03:13 PM

I've changed your code as follows:

Code:

#include <iostream>

int main()
{
std::cout << "Hello World\n";
system("PAUSE");
return 0;
}

What I've put up there works perfectly for me. Make sure return 0; is the final statement (I was wrong earlier about system("pause"); being the last).

Note the ; comes at the end of the lines, not at the end of the text string.

Any more problems, feel free to let me know.

Syn7ax 3rror 04-03-2005 04:14 PM

Ahhh. Tha's rite. Thanks!


All times are GMT -5. The time now is 06:39 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0