fork(2) download
  1. #include <string> // for std::string and std::getline
  2. #include <sstream> // for std::istringstream
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. for (std::string jimbob; std::getline(std::cin, jimbob); )
  8. {
  9. std::istringstream marysue(jimbob); // !
  10. for (std::string charlie; std::getline(marysue, charlie, ';'); )
  11. {
  12. std::cout << "You said, '" << charlie << "'\n";
  13. }
  14. }
  15. }
  16.  
Success #stdin #stdout 0s 2992KB
stdin
abc;def;ghi
10;;10
stdout
You said, 'abc'
You said, 'def'
You said, 'ghi'
You said, '10'
You said, ''
You said, '10'