vendredi 5 juillet 2019

Using std::endl vs "\n" when cin and cout are untied

Fast I/O recommends the use of following two line during programming competitions to speed up IO:

    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  

I can understand removal of sync. But after untying cin and cout how do I ensure that the buffer doesn't get overflowed and gets flushed properly when I am not using std::endl. Does the use of "\n" automatically handles it?

Aucun commentaire:

Enregistrer un commentaire