fork download
  1. #include <iostream>
  2. #include <sstream>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.  
  8. std::string line("Imagine this was from a file");
  9. // std::getline(infile, line);
  10.  
  11.  
  12. std::stringstream strstr(line);
  13.  
  14. string word;
  15. strstr >> word;
  16. cout << word << '\n';
  17. strstr >> word;
  18. cout << word << '\n';
  19. return 0;
  20. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Imagine
this