Erroneous info is being passed around here. <iostream.h> is the old-style C++ stream I/O header; the new one is <iostream>. You should aim to always use the new header unless you''re just prototyping some code you won''t have to live with in the future.
Having included the new-style header, cin, cout and all other iostream-defined objects and classes are declared under the std namespace. You can import the entire namespace into your working namespace (the top-level unnamed namespace), but that''s a bad idea in the long run.
using namespace std;
Alternatively, you can import particular entities from a namespace:
using std::cout;
After this line above, you can refer to cout anywhere in the same file (if it''s a header file, you can refer to cout without prefix in any other files that include it).
The third option is to explicitly qualify the object name every time you use it:
std::cout << "H1!" << std::endl;
As you can see, endl is also under the std namespace.
Finally, there''s no substitute for a good book and tons of trial and error. If you have more problems, the great folks here at GameDev are only too willing to help.
Happy Hacking!
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!