PDA

View Full Version : Error... WHY???



Rs-Gp-4U
02-09-2008, 05:45 PM
Hi guys i havnt bin on here for a while now, im trying to learn C++,
I know very little about the basics and now i get a error?


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

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

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


Aprently "error: `main' must return `int'",
Can someone correct my code please im a noob..

Do i have to have void main(int) or something? Please reply ASAP..

Markus
02-09-2008, 06:01 PM
// ****** 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 ********************
}

Rs-Gp-4U
02-09-2008, 06:06 PM
Thanks Mate - Im Blonde And All You See :P..

Btw.. I'm Using Dev-C++ And When I Click Run The Command Promt Program You've Made Comes Up But Then Closes Straight Away After..? How Can This Be Fixed??

Yakman
02-13-2008, 08:07 PM
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 :)