Can anyone please tell me exactly why printf-scanf works faster than cin-cout?
By default the i/o functions cin and cout are meant to synchronise with the library #include<stdio.h> . This makes them slow. You can change this by adding the following line below the int main () line of your function
Note that after using this line you cannot use any instances of scanf and printf in your program. Else it’ll give you a runtime error SIGSEGV. Also this makes cin and cout a tad bit faster than scanf and printf. You can check that on the problem INTEST.
This link will help you understand better about that.
check out this answer on quora: http://www.quora.com/Is-cin-cout-slower-than-scanf-printf
It wil not increase speed of cout though…