title: Split a sentence (string) at the spaces
body: <p>I am trying to split a single string, with spaces, into three separate strings. For example, I have one string (str1). The user inputs any 3 words such as 
  <code>"Hey it's me"</code> or <code>"It's hot out"</code>. 
  From there, I need to write a function that will take this string (str1) and divide it up into three different strings. So that (taking the first example) it will then say:</p>
  
  <pre><code>Hey (is the first part of the string)
  it's (is the second part of the string)
  me (is the third part of the string)
  </code></pre>
  
  <p>I'm having difficulty which manipulation I should be using to split the string at the spaces. </p>
  
  <p>This is the code I have so far, which is just how the user will enter input.I am looking for the most basic way to accomplish this <strong>WITHOUT</strong> using <code>istringstream</code>! Using only basic string manipulation such as find(), substr(). </p>
  
  <p>** I am looking to create a <strong>separate</strong> function to perform the breaking up of string ** I figured out how to get the first section of input with this code: </p>
  
  <pre><code>cout &lt;&lt; "Enter a string" &lt;&lt; endl;
  getline(cin, one);
  
  position = str1.find(' ', position);
  first_section = str1.substr(0, position);
  </code></pre>
  
  <p>But now I have no idea how to get the second section or the third section of the string to be divided up into their own string. I was thinking a for loop maybe?? Not sure.</p>
  
  <hr>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main() {
     string str1;
     cout &lt;&lt; "Enter three words: ";
     getline(cin, str1);
     while(cin) {
          cout &lt;&lt; "Original string: " &lt;&lt; str1 &lt;&lt; endl;
          cin &gt;&gt; str1;
     }
  
     return;
  }
  </code></pre>