Skip to content

Instantly share code, notes, and snippets.

@netj
Last active July 12, 2016 22:11
Show Gist options
  • Save netj/7333de10c6420443c9df80d444fe78c2 to your computer and use it in GitHub Desktop.
Save netj/7333de10c6420443c9df80d444fe78c2 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
// See: https://www.quora.com/Is-cin-cout-slower-than-scanf-printf/answer/Anders-Kaseorg
ios::sync_with_stdio(false);
string line;
while (cin) {
getline(cin, line);
cout << line << "\n"; // endl is worse as it flushes, but makes not much difference
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment