Program in via book by McGrath returns compilation error


The code for the first program in the book C++ Programming in Easy Steps by McGrath is as follows:

#include <iostream>
using namespace std ;

// A C++ program to output a greeting.

int main()
{
cout << "Hello World!" >> endl ;
reurn 0 ;
}
|


Attempt to compile it with GNU compiler by

(1) typing program with Windows Notepad
(2) saving as hello.cpp
(3) moving result to directory C:\MyPrograms
(4) at a command prompt, changing directory to C:\MyPrograms
(5) entering command c++ hello.cpp

yields

hello.cpp:12:1: error: expected unqualified-id before ':' token


Please tell me: Why do I get this error?

Gordon Fisher gmfisher7@optonline.net
#include <iostream>
using namespace std ;

// A C++ program to output a greeting.

int main()
{
cout << "Hello World!" >> endl ;
reurn 0 ;
}
|
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
 using namespace std ;

 // A C++ program to output a greeting.

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

Topic archived. No new replies allowed.