|
From: <wa...@wa...> - 2004-02-09 07:19:48
|
On 8 Feb 2004 at 19:10, vasanthsena x wrote: > Hi, > > I am new to c++.On many tutorials and books I have > seen the following > > #include <iostream> > > however this results in an error. > I did the following #include <iostream.h>.this works. > > My question is does it matter if we include ".h" > extension.and what is the right way. The ".h" is the "old" way and shouldn't really be supported anymore. If you use ".h", the compiler makes the assumption that you're following more of a C coding style than a C++ coding style. Mixing C and C++ like that is generally not a good thing. In C++, the common C header files can be included by dropping the .h and adding a c at the beginning like: #include <cstdlib> #include <cstdio> etc. BUT. What error are you getting? If you use #include <iostream> and then use a function from iostream, you have to either precede the function you're using with std:: or add the line "using namespace std;". Take a long hard look at namespaces. :) HTH. Watson (the pencil neck) Davis |