C++: printf Vs cout

Discussion in 'C++' started by Ying Yang, Sep 24, 2003.

  1. Ying Yang

    Ying Yang Guest

    Hi,

    Whats the difference between printf and cout? They both seem to do the same
    thing.


    Regards
    dsfg
     
    Ying Yang, Sep 24, 2003
    #1
    1. Advertising

  2. Ying Yang

    Unforgiven Guest

    Unforgiven, Sep 24, 2003
    #2
    1. Advertising

  3. Ying Yang

    Anthony Guest

    Re: printf Vs cout

    Hi,
    There is a whole book written about streams (cout).
    Think you'll find your answer there.
    http://www.langer.camelot.de/IOStreams/Excerpt/excerpt.htm#Main

    If that's not enough, here is a link to a very good c++ book (also available
    online)
    http://mindview.net/Books/DownloadSites
    The second edition of this book contains a chapter about streams.
    You will find the printf vs cout here.

    Greetingz
    Anthony


    "Ying Yang" <> schreef in bericht
    news:...
    > Hi,
    >
    > Whats the difference between printf and cout? They both seem to do the

    same
    > thing.
    >
    >
    > Regards
    > dsfg
    >
    >
     
    Anthony, Sep 24, 2003
    #3
  4. Ying Yang

    tom_usenet Guest

    On Wed, 24 Sep 2003 20:54:46 +0930, "Ying Yang" <>
    wrote:

    >Hi,
    >
    >Whats the difference between printf and cout? They both seem to do the same
    >thing.


    printf << "Hello"; //error
    cout("%s", "Hello"); //error

    In other words, they have completely different syntax. C++ has both, C
    only has printf.

    In high level terms, the main differences are type safety (cstdio
    doesn't have it), performance (most iostreams implementations are
    slower than the cstdio ones) and extensibility (iostreams allows
    custom output targets and seamless output of user defined types).

    Tom
     
    tom_usenet, Sep 24, 2003
    #4
  5. Kevin Goodsell, Sep 24, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abi

    man cout or info cout

    abi, Jun 27, 2003, in forum: C++
    Replies:
    2
    Views:
    1,672
  2. Pmb

    std::cout vs cout

    Pmb, Jun 2, 2004, in forum: C++
    Replies:
    2
    Views:
    4,447
    Leor Zolman
    Jun 2, 2004
  3. Replies:
    4
    Views:
    342
    Howard
    Sep 15, 2005
  4. Stefan Ram

    Re: cout vs std::cout

    Stefan Ram, Sep 28, 2008, in forum: C++
    Replies:
    7
    Views:
    512
  5. Hendrik Schober

    Re: cout vs std::cout

    Hendrik Schober, Sep 28, 2008, in forum: C++
    Replies:
    7
    Views:
    463
    Jerry Coffin
    Oct 7, 2008
Loading...

Share This Page