C++ I/O

In this lesson, we'll discuss how to handle input and output in C++ code.

We'll cover the following...

I/O in contests

In competitions, the input for your code has to read from standard input (most of the time) and you print the output to standout output.

In C++, two most common choices to do is

  • iosteams - cin / cout (NEW)
  • stdio - scanf / printf (C style)

Though it seems inconsequential, handling I/O correctly can make your solution milliseconds or even a few seconds. This becomes relevant when the input is huge (for example, reading ...