Question: I don't know if this is true, but when I was reading FAQ on one of the problem providing sites, I found something, that poke my attention:

> 
> Check your input/output methods. In C++, using cin and cout is too slow. Use these, and you will guarantee not being able to solve any problem with a decent amount of input or output. Use printf and scanf instead.
> 
> 
> 

Can someone please clarify this? Is really using *scanf()* in C++ programs faster than using *cin >> something* ? If yes, that is it a good practice to use it in C++ programs? I thought that it was C specific, though I am just learning C++...

Answer: 
<http://www.quora.com/Is-cin-cout-slower-than-scanf-printf/answer/Aditya-Vishwakarma>

Performance of `cin`/`cout` can be slow because they need to keep themselves in sync with the underlying C library. This is essential if both C IO and C++ IO is going to be used.

However, if you only going to use C++ IO, then simply use the below line before any IO operations.

```
std::ios::sync_with_stdio(false);

```

For more info on this, look at the corresponding [libstdc++ docs](http://gcc.gnu.org/onlinedocs/libstdc++/manual/io_and_c.html).
The problem is that `cin` has a lot of overhead involved because it gives you an abstraction layer above `scanf()` calls. You shouldn't use `scanf()` over `cin` if you are writing C++ software because that is want `cin` is for. If you want performance, you probably wouldn't be writing I/O in C++ anyway.