Thread: tutorial confusion <<endl;

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    1

    tutorial confusion <<endl;

    in lesson 3, loops

    cout<<x<<endl;

    cout<<x; makes perfectly sense to my, but why adding <<endl, what does it change? it can't be a variable since it never gets defined.

    if it's something like endlOOP.. that makes no sense to me either since } ends the loop, in a further code there even is written x++; below it... anyway, i'm confused. about that little thing.

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    311
    end line This is just a slightly fancyer and cooler way of saying cout << x << '\n'. The cooler part is that it flushes the buffer. cout does not always write what you send to it right away. It tries to build up a bunch of things to send in one block.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    48
    endl is end line, it does the same thing as /n.

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>endl is end line, it does the same thing as /n.

    It also flushes the output buffer.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    i didn't know it flushed the output buffer... interesting...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    01000111011011110110111101100100 011101000110100001101001011011100110011101110011 01100100011011110110111001110100 01100011011011110110110101100101 01100101011000010111100101110011 0110100101101110 01101100011010010110011001100101
    Good things donīt come easy in life!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 01:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Confusion with DirectMusic tutorial
    By Hunter2 in forum Game Programming
    Replies: 0
    Last Post: 06-09-2003, 09:24 PM
  5. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM