Although input and output are implemented with streams for both
C and
C++, the
C++ I/O stream classes provide the same facilities
for input and output as C
stdio.h. The I/O stream classes
in the Standard
C++ Library have the following advantages:
- The input (>>) operator and output (<<) operator are typesafe.
These operators are easier to use than scanf() and printf().
- You can overload the input and output operators to define input
and output for your own types and classes. This makes input and output
across types, including your own, uniform.