N8LnR2Nqf8Q4FN's blog

By N8LnR2Nqf8Q4FN, history, 3 years ago, In English

There have been countless blogs about whether one should choose scanf/printf, or cin/cout as the main methods for getting inputs/outputs for C++. There are advantages and disadvantages of each kind, like the ability to easily format outputs, stream operator overloading, or not having to care about the decltype, etc.

But, from what I have seen, there are rarely any blogs that I can find myself, that mention the combination of cin/printf. This seems like a pretty good combination, and I have seen one or two people using it. One can get inputs without having to painfully type & every time, and nicely formatted outputs without a bunch of << operators.

Is there any disadvantage of this combination? Why do we hardly see anyone using those together?

  • Vote: I like it
  • -8
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Because if you want to use cin/cout and scanf/printf together you cannot write in your code ios_base::sync_with_stdio(false);. This line speedups using cin/cout but you cannot then use scanf/printf, and using cin/cout without this line you can get TLE.