fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. string longestword = "nguyen huu thang";
  9. stringstream ss(longestword);
  10. string word;
  11. int dem = 0;
  12. while(ss >> word){
  13. ++dem;
  14. cout << "Tu thu " << dem << " tach duoc : " << word << endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Tu thu 1 tach duoc : nguyen
Tu thu 2 tach duoc : huu
Tu thu 3 tach duoc : thang