Thread: printf vs cout

  1. #16
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    I think C++ Cout and stuff was made to make it easier for new users to learn and understand programming. Also convenience, easier to type it out.

    But the C library printf, sprintf, and the tons of other functions, are extremely useful for dealing with chars and even for Win32 sometimes. They are definitely better.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by brewbuck
    The stream insertion operator makes things convenient and extensible, but I think it's hard to dispute the compactness and clarity of printf-style format specifiers, even if they aren't type-safe.
    I recall that the Boost Format library, mentioned by phantomotap, aims to provide "printf-like formatting, in a type-safe manner which allows output of user-defined types".

    Quote Originally Posted by execute
    They are definitely better.
    No since they are not type-safe, though they are better in some ways, as mentioned earlier.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 09:38 AM
  3. Need Help with a Bowling Score Program
    By oobootsy1 in forum C++ Programming
    Replies: 6
    Last Post: 11-01-2005, 10:04 AM
  4. Whats Wrong Whith This!?
    By SmokingMonkey in forum C++ Programming
    Replies: 8
    Last Post: 06-01-2003, 09:42 PM
  5. (printf VS cout) and (including libraries)
    By \cFallen in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2003, 09:47 PM