Hello World Error

Hello, I'm new to C++ and am beginning to learn it by reading "Sams Teach Yourself In One Hour A Day (6th Edition)". I'm using Bloodsheds Dev-C++ as the compiler and am having difficulties compiling the Hello World code from the book.

For some reason it gives me an error on the 5th line ( std::co...)

C++ Code:
1
2
3
4
5
6
7
#include <iostream>

int main()
{
 std::cout << “Hello World!\n”;
 return 0;
}


Thx 4 Reading.
 
 std::cout << "Hello World!\n";
Last edited on
Denis is right. There is something weird about your " "

You may wanna try the following as well. i.e. Try using namespace..

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

using namespace std;

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

Make sure you are using a plain-text editor (like Notepad or Emacs), and not your favorite word processor (like Word or Writer).
Ahh I see. It's probably because I copy/pasted the code from an ebook into the compiler. Can't believe I didn't notice that. Well thanks, that helped.
Yeah, those stupid "smart quotes" get people all the time.
Topic archived. No new replies allowed.