I'm very green

I'm just starting out. In the book it shows
1: #include <iostream>
2: int main()
3: {
4: int x = 5;
5: int y = 7;
6: std::cout << std::endl;
7: std::cout << x + y << “ “ << x * y;
8: std::cout << std::endl;
9: return 0;
10:}

I'm using VS 2008 and I'm getting:
1. Error C2143: Syntax error : missing ";" before 'string'
2. Error C2296: '<<' illegal, left operand has type 'const char [2]'

Googled it, but not really seeing a clear answer. Course I'm a beginner.

Book: Teach yourself c++ in one hour a day

Is the book out dated or compiler? Any suggestions would be great. Thanks.
The code you've shown us doesn't contain the word string and doesn't contain any objects of type char. If I had to guess, that code is not what you're feeding the compiler.
I don't want to just skip it. Would rather learn the "Why"
Try closing the IDE, then re-opening it, and open the project file; this should close any projects also open that it might be reading code from, and just leave the code you want.

The book is likely not out of date, nor is the compiler. It's just that the comiler is being fed the wrong code by the IDE, as Moschops says above.

Also, just me being a perfectionist, next time, could you paste code using the "Code" option? Cheers :)

Thanks,
Hnefatl
I am not sure if this is how it actually is in your code. But I get an error because of the “ “ as they aren't standard quotation marks (might explain the const char[2] error).

If closing your project doesn't work as suggested above try replacing them with " ".
It was

std::cout << x + y << " " << x * y;

not

std::cout << x + y << “ “ << x * y;

See the difference :)

Thanks.
Topic archived. No new replies allowed.