Personally, I use printf
over the iostream
stuff (like cout
) because I think it's clearer.
When you do formatting with iostream
, you have to <<
all sorts of weirdness like setiosflags
and setf
. I can never remember which namespace all this stuff lives in, let alone what it all does. Even when I do, I'm disappointed with how verbose and unintuitive the code looks.
The formatting options with printf
may seem illegible at first, but they're concise, clearly documented in a single manual page, and common to a wide range of languages.
Another advanage is that printf
is stateless: Unlike with cout
, I don't need to remember which member functions have been called on printf
, or which byzantine concoction of flags has been <<
'ed into it. This is a big plus for readability.