Ray,

Thanks. I was wondering both why it worked both ways. I believe you've given me 
a very useful piece of information.

Regards,
Chip

----- Original Message ----
From: Ray Devore <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, May 25, 2007 9:46:54 PM
Subject: Re: [c-prog] Re: Hello World

--- chipaug <[EMAIL PROTECTED] com> wrote:
> --- In [EMAIL PROTECTED] com, "pankaj kumar"
> <pankajlove99in@ ...> 
> wrote:
> >
> > Hi Chip,
> > 
> > 1.Use <iostream> and not <iostream.h>
> > 
> > 2.Use namespace std;
> > 
> > So the following :
> > 
> > 
> > 
> > 
> > #include <iostream>
> > 
> > using namespace std;
The above statement is not necessary since you are
using std:: in the code below. Using the std:: with
the appropriate items makes for cleaner code. When
you use "using namespace std;" you have destroyed the
reason for doing a namespace in the first place. You
also get things from the namespace that you do not
expect.

Ray

> > 
> > int main()
> > 
> > {
> > 
> > std::cout << "Hello, World!" << std::endl;
> > 
> > return 0;
> > 
> > }
> > 
> > 
> > 
> > Thanks
> > 
> > Pankaj
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On 5/23/07, chipaug <[EMAIL PROTECTED] ..> wrote:
> > >
> > > I'm trying to learn C++. I've gotten a copy of
> "Accelerated 
> C++" and
> > > have started to read. I got as far as the first
> paragraph in 
> chapter
> > > 0 before getting stuck. The Hello World program
> in the book is as
> > > follows.
> > >
> > > // a small C++ program
> > >
> > > #include <iostream.h>
> > >
> > > int main()
> > > {
> > > std::cout << "Hello, World!" << std::endl;
> > > return 0;
> > > }
> > >
> > > When I attempt to build this in Visual Studio 6,
> I get the 
> following
> > > errors.
> > >
> > > C:\Documents and Settings\Kenneth\ My
> Documents\cpp\ 1
> > > \HelloWorld\ HelloWorld. cpp(7) : error C2653:
> 'std' : is not a 
> class
> > > or namespace name
> > > C:\Documents and Settings\Kenneth\ My
> Documents\cpp\ 1
> > > \HelloWorld\ HelloWorld. cpp(7) : error C2653:
> 'std' : is not a 
> class
> > > or namespace name
> > >
> > > If I remove the "std::" from the cout and endl,
> it appears to 
> build
> > > without complaint and runs with the expected
> output.
> > >
> > > Thanks for your help.
> > > Chip Auger
> > >
> > > 
> > >
> > 
> > 
> > [Non-text portions of this message have been
> removed]
> >
> 
> Thank you, Pankaj. I removed the .h and it built
> correctly.
> 
> Regards,
> Chip
> 
> 

____________ _________ _________ _________ _________ _________ _
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo. com/




 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

[Non-text portions of this message have been removed]

Reply via email to