title: How to read output of a vector<string> with a certain number of words to a line?
body: <p>I am really struggling with a question I am working through in a book. I am learning C++ by myself and am only up to Chapter 3, but this question has really got me stuck.</p>
  
  <p>The question is:
  "Read a sequence of words from din and store the values [in] a vector. After you've read all the words, process the vector and change each word to uppercase. Print the transformed elements, eight words to a line." - Exercise 3.17 in C++ Primer (5th Edition)</p>
  
  <p>I can store in vector and change all words to uppercase no problem. It is the printing them out thing that is an issue.</p>
  
  <p>Pleas could you help me!! I am so frustrated!!! Please also keep it really nice and simple, it is only Chapter 3 and I'd like to write the answer at thatlevel rather than complicated (for my current level) code.</p>
  
  <p>Greatly appreciate all help!!</p>
  
  <p>Here's my code right now:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  using std::string; using std::vector; using std::cout; using std::cin; using std::endl;
  
  int main ()
  {
      vector&lt;string&gt; v1;  // Create an empty vector
  
      string words;     // Create a string "words"
      string output;
  
      while (cin &gt;&gt; words) {
          v1.push_back(words);
      }
      for (auto i = 0; i&lt;v1.size(); ++i){
          for (auto &amp;s : v1) {
              for (auto &amp;c : s)
                  c = toupper(c);
          }
          cout &lt;&lt; v1[i] &lt;&lt; " ";
      }
  }
  </code></pre>