Hello,
I included the header "iostream"
Why is there only the possiblity of including
#include<iostream>? From Visual C++ 6 I know the iostream.h.
The name doesnt't really interest me. But it should work. The library
consists of the commands like "cout", "cin", ... But if I want to use
these commands I get an compiler error that they are unknown.
What's the problem? Do I miss something?
Thanks
Sarah
Antti Keskinen - 12 Feb 2005 16:20 GMT
There's a subtle difference.
"iostream.h" is the header file for the old Standard C++ Library. This file
is deprecated in Visual C++ .NET 2003. Instead, you must use "iostream"
header and specify the namespace "std" to access the good-old "cout", "cin"
etc functions. If you wish to know more of this behaviour, search MSDN with
string "iostream differences from Standard C++ Library"
There are two choices you can use. Which one you choose is a matter of
preference and taste. Naturally, it may be a matter of namespace clashing if
you have similarly named functions, objects or structures as the Standard
C++ Library.
Solution #1: The 'using namespace' keyword (generally safe)
#include <iostream>
using namespace std;
cout << "This will print a line of text" << endl;
----
Solution #2: Full namespace resolution (always safe, but bulkier)
#include <iostream>
std::cout << "This will print a line of text, too" << std::endl;
----
Hope this helps
-Antti Keskinen
> Hello,
>
[quoted text clipped - 16 lines]
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
Ioannis Vranos - 12 Feb 2005 17:24 GMT
> Hello,
>
> I included the header "iostream"
>
> Why is there only the possiblity of including
> #include<iostream>? From Visual C++ 6 I know the iostream.h.
The official ISO C++ standard (ISO/IEC 14882:1998, and 2003) defines
<iostream>.
VC++ 6 was a pre-standard compiler. A nice book to get you up and
running with ISO C++, is "Accelerated C++" by Andrew Koenig, Barbara Moo:
http://www.acceleratedcpp.com
If you want to learn the entire language (which will take *years*), is
"The C++ Programming Language" 3rd Edition or Special Edition by Bjarne
Stroustrup, the creator of C++:
http://www.research.att.com/~bs/3rd.html
> The name doesnt't really interest me. But it should work. The library
> consists of the commands like "cout", "cin", ... But if I want to use
[quoted text clipped - 4 lines]
> Thanks
> Sarah
using namespace std;

Signature
Ioannis Vranos