You are not logged in. Please login at to post your questions!


About Printf-Scanf and Cin-Cout

Can anyone please tell me exactly why printf-scanf works faster than cin-cout?

asked 11 Oct '14, 22:03

moudud99's gravatar image

accept rate: 11%

(11 Oct '14, 23:03) nishant20024★

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.


answered 11 Oct '14, 22:21

pranjalranjan's gravatar image

accept rate: 20%

(11 Oct '14, 22:50) pranjalranjan4★

It wil not increase speed of cout though..

(02 Aug '17, 11:17) kauts_kanu5★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 11 Oct '14, 22:03

question was seen: 3,078 times

last updated: 02 Aug '17, 15:33