Re: [SLUG] C++ newbie problems

From: Paul Braman (aeon@tampabay.rr.com)
Date: Thu Jan 09 2003 - 17:31:12 EST


Heh...I knew someone would speak up on this subject. :)

Let me start by saying, "you're wrong".

Put simply, once you understand exactly what "endl" does you'll understand
why "\n" is a valid, useful way to terminate a line. In fact, this very
same construct is used in the standard itself (Section 12.1 paragraph 15):

    cout << cobj.c * 100 << '\n';

It's not there to demonstrate a bad way of doing things, either. ;)

Paul Braman
Senior Application Technical Specialist
Nielsen Media Research
aeon@tampabay.rr.com

On Thu, 9 Jan 2003, Carson Wilcox wrote:

> Not true, if you are going to learn C++ you should learn it
> correctly and using \n to end a cout statement is not correct. It
> mixes c and c++ syntax and that is not good coding style.
>
> Carson R. Wilcox
> Senior Systems Architect
> Fujitsu Consulting
> Tampa, FL
> carsonw@users.sf.net
>
>
>
> ---------- Original Message ----------------------------------
> From: Paul Braman <aeon@tampabay.rr.com>
> Reply-To: slug@nks.net
> Date: Thu, 9 Jan 2003 07:39:02 -0500 (EST)
>
> >
> >On Thu, 9 Jan 2003, Carson Wilcox wrote:
> >
> >> I also have to add the the correct way to write the cout line
> is:
> >>
> >> cout << "Welcome to C++!" << endl;
> >>
> >> The you have it will work but is not the C++ way.
> >
> >Let's not cloud the issue. The original line,
> >
> > cout << "Welcome to C++!\n";
> >
> >is just as "correct" as yours. It may be more consistent to
> teach using
> >"endl", but it is no more correct than the line above.
> >
> >
> >Paul Braman
> >aeon@tampabay.rr.com
> >
> >
>



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 13:07:13 EDT