![]() |
|
#1
|
|||
|
|||
Can't run any programs I compile, please helpI recently started learning how to code in C++. The problem is, any program I compile doesn't work.
There are no errors in the code whatsoever, and when I debug it step by step, it works until the very end. When I try to run it, the dos window comes up in a flash and is gone. I'm using bloodshed dev-c++ version 4.1, and I'm running Windows XP. When I send the files to my friend, he gets the same problem. However, the Java programs that he compiles work fine. Is it a problem with my compiler? |
|
#2
|
|||
|
|||
|
Quote:
If you look at sample programs in dev-c++, they all have something like this at the end of the main(): CPP / C++ / C Code:
This prints a message to "Press any key to continue . . ." and waits for a keypress to end the program. This is to keep the program from exiting and closing its console window until you press a key. Not all systems have an executable named pause, so this is not very portable. I always recommend getting into the habit of using standard library functions and being operating-system independent as much as possible. I would recommend something like this for C programs (assuming you have #included stdio.h): CPP / C++ / C Code:
For C++ (assuming you have #included <iostream>): CPP / C++ / C Code:
Regards, Dave |
|
#3
|
|||
|
|||
|
Thanks alot, that was a big help. :D
|
Recent GIDBlog
Meeting the populace by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working with other programs? | leitz | C++ Forum | 4 | 14-Nov-2004 05:22 |
| help in c programs | kitin21 | C Programming Language | 4 | 08-Sep-2004 07:38 |
| strange compile error - code from reputable author!! | newbie_cpp | C++ Forum | 0 | 06-Nov-2003 16:15 |
| premade forums and other premade php programs | invaderz | MySQL / PHP Forum | 1 | 06-Jul-2003 02:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The