C++ people: printf() vs cout

Discussion in 'OT Technology' started by Joe_Cool, Jan 29, 2005.

?

printf or cout?

  1. printf() because flexibility and control rules all

    12 vote(s)
    52.2%
  2. cout because ease of use is the most important

    11 vote(s)
    47.8%
  3. huh?

    0 vote(s)
    0.0%
  1. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,206
    Likes Received:
    516
    Do you prefer ease of use, or flexibility and power?
     
  2. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    I generally use cout.
     
  3. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    we only used cout in school, and I never used console apps outside of the classroom, so I vote cout, lol.
     
  4. skinjob

    skinjob Active Member

    Joined:
    Jan 6, 2001
    Messages:
    2,337
    Likes Received:
    0
    Location:
    Aztlán
    cout along with iomanip can be every bit as flexible as printf. But the more formatting you need, the more cumbersome cout gets. printf is generally easier to use when there's lots of formatting.
     
  5. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,206
    Likes Received:
    516
    Never do anything in unix, eh? :mamoru:

    The reason I brought it up is that I wrote a little program to generate math tests for my daughter. And printf was so much better for formatting the problems on the page.

    for simple output, I generally use cout, but for anything where I need formatting, I always use printf.
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    yes, but it is all in bash.
     
  7. mace

    mace i don't read

    Joined:
    Jun 6, 2004
    Messages:
    12,567
    Likes Received:
    0
    Location:
    Texas
    printf for the win
     
  8. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
  9. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    printf for all the geeks who voted and didn't want to reply :big grin:
     
  10. deezil

    deezil Guest

  11. WERUreo

    WERUreo Imua!

    Joined:
    Oct 15, 2003
    Messages:
    566
    Likes Received:
    0
    Location:
    Daytona Beach, Florida
    I gotta go with printf
     
  12. adam17

    adam17 now im gonna sing the doom song! doom doom doom do

    Joined:
    Aug 25, 2004
    Messages:
    1,666
    Likes Received:
    0
    Location:
    n ur gf's bed
    i made the transition recently from cout to printf() simply because i had to use scanf() and its derivatives for my file loader. it is hella better
     

Share This Page