#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;
}
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/
#include <iostream>
usingnamespace 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.
#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.