Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // По умолчанию потоки cout и cerr связаны с потоком cin
- // Это может замедлять программы типа stdin -> stdout
- // Наряду с заменой endl на '\n' добавляйте cin.tie(nullptr) в начало своих программ
- #include <iostream>
- #include <vector>
- #include <fstream>
- #include "log_duration.h"
- using namespace std;
- int main()
- {
- cin.tie(nullptr);
- {
- LOG_DURATION("endl");
- for (int i = 0; i < 100'000; ++i)
- {
- int x;
- cin >> x;
- cout << x << endl;
- }
- }
- {
- LOG_DURATION("'\\n'");
- for (int i = 0; i < 100'000; ++i)
- {
- int x;
- cin >> x;
- cout << x << '\n';
- }
- }
- /*cin.tie(nullptr);
- cout << "Enter two integers: ";
- int x, y;
- cin >> x >> y;
- for (;;)
- {
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement