Starting out, and don't understand this
Hey all,
Im reading Sams Teach Yourself C++ in 21 Days. Its a good book so far I think. But I think he wrote something wrong.
I am typing in the code exactly as soon on page 18:
Code:
#include <iostream>
int main()
{
std:cout << "Hello World!\n";
int x;
std::cin >> x;
return 0;
}
And I get the following errors:
--------------------Configuration: Example1 - Win32 Debug--------------------
Compiling...
ex1.cpp
c:\program files\microsoft visual studio\myprojects\example1\ex1.cpp(5) : error C2065: 'cout' : undeclared identifier
c:\program files\microsoft visual studio\myprojects\example1\ex1.cpp(5) : error C2297: '<<' : illegal, right operand has type 'char [14]'
Error executing cl.exe.
Example1.exe - 2 error(s), 0 warning(s)
Can anyone tell me what is wrong? I copied it exactly out of the book. Im using Microsoft Visual C++ 6.0
If you need any other info let me know, thanks in advance to anyone that helps me out.
You can download the source code.
First, it's a really good idea to hand-type in all of the example programs. But, you can download the source code at the author's website. I had to do this a couple of times when I couldn't see my typo.