aza-zil's blog

By aza-zil, history, 5 years ago, In English

Hey!

If I'm using cin/cout with ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) , does scanf/printf still better to use ?

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

| Write comment?
»
5 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Sometimes scanf/printf is better. For example,We need read some dates like 1999/12/31,if you use scanf you only need to code like: int y,m,d; scanf("%d/%d/%d",&y,&m,&d);

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

yes it is scanf and printf are still faster

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

cout.tie(0) is unnecessary to use. But you need to use cout << “\n”; instead of cout << endl

»
5 years ago, # |
  Vote: I like it -13 Vote: I do not like it

I think my fastio template works well using fread. If you use a template of fastio,it is also short to code. For example:1992/12/31,my function getint() would skip the '/' as ' '.