Cant Compile "Hello world"

Hello
Im using this online book to study C++
http://www.cesis.lv/learn/C++/htm/ch01.htm

And when im trying to Compile the project there are errors
that i dont undarstand or know how to fix:
http://img23.imageshack.us/img23/392/123po8.jpg

Please help

P.S
Im using Dev-C++ (windows Vista 32Bit)
I also have Microsoft Visual C++ and i got errors in there too but cant
see them at all!
A few things wrong with this:

1
2
3
4
5
6
7
8
#include <iostream.h>   // Deprecated, should be #include <iostream>
// You will also need "using namespace std;" here

int main(); // You have a semicolon here that shouldn't be
{
    cout << "Hello World!";
    return 0;
}


Here's a cleaner version:

1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!";
    return 0;
}


The tutorial you are referring to is out of date and does not conform to the standard. Try a more up to date tutorial like the one on this site: http://www.cplusplus.com/doc/tutorial/

You don't have to include:

using namespace std;

You can do:

1
2
3
4
5
6
7
8
9
10
#include <iostream>

using namespace std;

int main()
{
    std::cout << "Hello World!";
    std::cout << "\nSee, not including it works too, but it's tedious to say the least.";
    return 0;
}


Output:

1
2
Hello World!
See, not including it works too, but it's tedious to say the least. 
you can do:

#include<iostream>
using namespace std;

int main()
{
cout<<"hello world"<<endl;
return 0;
}
closed account (z05DSL3A)
You can also do:
1
2
3
4
5
6
7
8
9
10
#include<iostream>
using std::cout;
using std::endl;


int main()
{
    cout << "Foo Bar!" << endl;
    return 0;
}


But it is all academic, as Lodger said the source the OP is learning from is "out of date and does not conform to the standard", so the root of the problem is the on-line book.
Topic archived. No new replies allowed.