I have just started learning C++ from the book "SAMS Teach Yourself C++ in 21 Days" and the very first exercise (after Hello World) won't compile in g++. I've checked to make sure I wasn't making any typos or anything, and I have definitely typed exactly what it says in the book.
Here is the code:
and the errors are as follows:
Does it have something to do with the compiler, or maybe with my system (Mac OS X 10.4.11 running on a 800 MHz PowerPC G4 iMac)?
I saw this same question by a Linux user somewhere else on the internet, and it seems that the consensus there is that the book has made an error. Though this is possible, I have heard many good things about this book from multiple sources, and I kind of doubt that this is the case.
Anyway, I hope somebody can help me and reply soon.
Thanks in advance,
Alex.
Here is the code:
#include <iostream>
int main()
{
int x = 5;
int y = 7;
std::cout << end1;
std::cout << x + y << " " << x * y;
std::cout << end;
return 0;
}
and the errors are as follows:
Untitled.cpp: In function `int main()':
Untitled.cpp:6: error: 'end1' was not declared in this scope
Untitled.cpp:8: error: 'end' was not declared in this scope
Does it have something to do with the compiler, or maybe with my system (Mac OS X 10.4.11 running on a 800 MHz PowerPC G4 iMac)?
I saw this same question by a Linux user somewhere else on the internet, and it seems that the consensus there is that the book has made an error. Though this is possible, I have heard many good things about this book from multiple sources, and I kind of doubt that this is the case.
Anyway, I hope somebody can help me and reply soon.
Thanks in advance,
Alex.