fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. stringstream test1{"\r\n"},
  8. test2{"\r"},
  9. test3{"\n"};
  10.  
  11. string o1, o2, o3;
  12. getline(test1, o1, '\n');
  13. getline(test2, o2, '\n');
  14. getline(test3, o3, '\n');
  15.  
  16. cout << o1.size() << endl
  17. << o2.size() << endl
  18. << o3.size() << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1
1
0