SRL Archive - C/C++ Help and Tutorials

Can't Run Program.. Dev-C++


Rs-Gp-4U

2008-02-10 03:59:38

Hey guys im a C++ noob :P, I have Dev-C++ and my code is clear for any errors but as soon as i click run the program comes up :D … for about 2 seconds then closes.. how can i fix this? PLEASE ANSWER ASAP..

EDIT: Heres code to prove its error-free

// © - Kizzop Productions 2008

// ****** Includes ******
#include <iostream.h>
// ****** Includes ******

// *** Variable ***
int Year = 2008;
// *** Variable ***

int main()
{
// ******************** What To Say ********************
cout << "Hello World.. The Year Is " << Year << endl;
// ******************** What To Say ********************
}

Wizzup?

2008-02-10 04:13:58

add this after your cout:

  int f;
cin >> f;

The window will not close until you give it some keyboard input. ;)

Rs-Gp-4U

2008-02-10 04:17:09

Thanks!! "Wizzup?" FTW!! :D

Yakman

2008-02-13 15:06:29

I've un-deleted this thread.
Please don't delete your own thread if the question is solved, the whole point of a forum is so questions can be asked, and the answers stay there for someone else to read them, so that person doesnt have to post an identical thread to this one.

Have a nice day :)

bth8

2008-03-16 03:42:18

add this after your cout:


Code:
int f;
cin >> f;The window will not close until you give it some keyboard input.


no no no thats a common misconseption. wat u need 2 do is put it in ur c:/ folder then go to cmd and type in (if the thing is named hello_world.exe) c:/hello_world

Rs-Gp-4U

2008-03-16 07:04:36

Thanks for replying a MONTH late ! and all you have to do is system("PAUSE>nul");

insanomano

2008-05-27 22:07:21

wooot good thing this is was undeleted cuz I was encountering the same error!!!!!! thanks Wizzup? :D your method helped lol

Bobarkinator

2008-05-28 02:10:37

Lets try not to grave dig

Smartzkid

2008-05-28 23:54:31

It helped him though, he was just saying thanks; Is that worthy of a gravedig? I'd say so…

man slaughter

2008-05-29 11:35:49

From: Bobarkinator
Lets try not to grave dig


you really love…(shuts tfu)

your not the firsst person who cant compile something. i had a bunch of programs i had made and now that i upgraded to vs 2008 i cant compile alot of them. to Smartzkid's well i guess so, but its been a while he probably dumped C++ or found a solution.