title: Split user input into two words in a vector
body: <p>Basically, I want the program to allow the user to input say, 2 words, and then split it into a vector. Like, if the user inputs: "Hello world," the program will take the words "Hello," and "world," and store them in a vector. The problem is, I'm not very experienced with vectors, so I have no clue where to start. Here's my code so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  void command_case();
  
  string userIn;
  int x = 0;
  
  int main()
  {
      while(userIn != "QUIT")
      {
          cout &lt;&lt; "What shall I do?" &lt;&lt; endl;
          cin &gt;&gt; userIn;
          cout &lt;&lt; "Your raw command was: " &lt;&lt; userIn &lt;&lt; endl;
          command_case();
      }
  }
  
  void command_case()
  {
      vector&lt;char&gt; Search;
      vector&lt;string&gt; command;
      char space = ' ';
      for(int i = 0; i &lt; userIn.size(); ++i)
      {
          if(userIn[i] != space)
          {
              userIn[i] = toupper(userIn[i]);
          }
          if(userIn[i] == space)
          {
              Search.push_back(userIn[i]);
          }
      }
      command.push_back(userIn);
      cout &lt;&lt; command[x] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>If I input "Hello world," I get this:</p>
  
  <pre><code>What shall I do?
  Hello world
  Your raw command was: Hello
  HELLO
  What shall I do?
  Your raw command was: world
  WORLD
  </code></pre>
  
  <p>but I would be looking for this:</p>
  
  <pre><code>What shall I do?
  Hello world
  Your raw command was: Hello world
  HELLO WORLD
  </code></pre>
  
  <p>Could anyone explain to me what I'm doing wrong?</p>