title: how to separate sentence[i] (string) into words(string) in c++
body: <p>I have a problem. In my project, I take sentence line by line from dataset file which has one sentence each line. Then , I should separate sentences into words. But I couldn't find this how can I do.</p>
  
  <p>This are the codes of class which will read from dataset:</p>
  
  <pre><code>class Input{
  ...
  public:
  string *word;
  string *sentence;
  Couple *couple;    // int x , int y  order of sentence and word
  int number;
  int line;
  ...
  void readInput(string input);
  }
  </code></pre>
  
  <p>This are the codes of read method:</p>
  
  <pre><code>void Input::readInput(string input)
  {
  cout &lt;&lt; "Reading the " &lt;&lt; input &lt;&lt;endl;
  
  ifstream infile;
  infile.open(input.c_str());
  
      if(!infile.is_open()){
      cerr &lt;&lt; "Unable to open file: " &lt;&lt; input &lt;&lt; endl &lt;&lt; endl;
      exit(-1);
  }
  
  for(int i=0; i&lt;line ; i++){
      getline(infile, sentence[i]);
      //infile &gt;&gt; sentence[i];
  }
  
  for(int j=0;j&lt;line ;j++){
  // I want to separate sentences into words
  }    
  
  infile.close();
  cout &lt;&lt; "Finished Reading the " &lt;&lt; input &lt;&lt;endl;
  </code></pre>
  
  <p>}</p>