Here is my code maybe it is a typo....
//I fail Srry Bin rev :-(
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 8;
}
:-)
Posted 02 September 2009 - 02:15 AM
//I fail Srry Bin rev :-(
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 8;
}
:-)
Posted 02 September 2009 - 02:26 AM
Posted 02 September 2009 - 06:30 AM
Yes, DevC++ is buggy, but it works always fine if you write some lines in C!!Everything is working fine here. You run the program, it opens a terminal window, prints the message, then exits. When it exits, it closes the terminal window. It's only supposed to run for a split second, that's what you told it to do. Open a command prompt, go to the exe, and run it from there. Alternatively, add a getch(); line to the end of main (just before the return statement) so it'll wait for you to hit enter.
Also, don't use Dev-C++. First, it uses MingW. This is a Windows port of GCC. It's always buggy. It's always been buggy. It will always be buggy. Even with simple code, it's possible you'll encounter completely unexplainable bugs. Second, Dev-C++ hasn't been update since February of 2005. It's been abandoned. It's using a now ancient version of GCC, and a buggy Windows port of it at that. Why it's recommended and why people download it is beyond me. What you want is Visual C++ Express Edition. It's free. It's modern. It works really well. It's much more complex, but you rarely have to go delving into the config dialogs. Download it, and be happy.
Edit: You also don't want to return 8 from main. If everything went well and there were no errors, you want to return 0. Doesn't matter much on Windows, but it does on Linux if you ever want to use your programs in shell scripts.
Posted 02 September 2009 - 07:12 AM
system("pause");Edited by chown, 02 September 2009 - 07:14 AM.
Posted 02 September 2009 - 01:30 PM
Yes, DevC++ is buggy, but it works always fine if you write some lines in C!!
If you want you can use Code::Blocks, a very good IDE for coding in C++!
You can easily find it here and for this program there are a Linux-version and a Windows version!
Put this code on a line before the "return 8;":
system("pause");
Edit: Ohm's getch() idea is better
Posted 02 September 2009 - 03:03 PM
Posted 02 September 2009 - 08:48 PM
thanks for this I have been looking for something to stop the script from going so fast across the screen for ages. this has really helped me with that!
Posted 02 September 2009 - 10:25 PM
system("pause");But the one before :getch()The window was still closing instantly. Is there somthing that needs to be contained in ()?
Edited by 1337_snic, 02 September 2009 - 10:28 PM.
Posted 02 September 2009 - 11:21 PM
Posted 02 September 2009 - 11:38 PM
Posted 04 September 2009 - 05:22 PM
If you want to stop your windows you can use or and ifdef declaration, or else you can use the getchar() function that attemps a character in input and it's useful to you to have the time to watch the program's results!Ok so i was able to get it to pause and wait untill i press a key with:
system("pause");But the one before :getch()The window was still closing instantly. Is there somthing that needs to be contained in ()?
Posted 07 September 2009 - 10:28 PM
Posted 07 September 2009 - 10:51 PM
Posted 08 September 2009 - 01:27 PM
Gedit? I suppose that'll work, but for coding I usually want an editor with a little more oomph. I use vim, the learning curve is a bit steep compared to something like gedit, but the payoff is definitely worth it. For project management, I just use make. I don't do any large-scale projects though, so for those you might want a real IDE.
Posted 11 September 2009 - 10:28 AM
BinRev is hosted by the great people at Lunarpages!