title: I would like to create a function that reads each line of the input and produces its sum and save that as sum.txt using C++
body: <p>Let's assume that I have the following input:</p>
  
  <pre><code>1 2 3 
  5 6
  10 11
  13
  </code></pre>
  
  <p>stored in <code>wow.txt</code>.</p>
  
  <p>I would like to create a function that reads each line of the input and 
  produces its sum and save that as <code>sum.txt</code> using C++.</p>
  
  <p>In the input file, we have the following:</p>
  
  <p>1) we don't know the length of each line, but it has at most 10 integers.<br>
  2) each integer is separated by a space.</p>
  
  <p>So I started with</p>
  
  <pre><code>ifstream inFile;
  inFile.open("wow.txt");
  ofstream outFile;
  outFile.open("sum.txt");
  </code></pre>
  
  <p>and wasn't sure what to do next.</p>
  
  <p>Some of my friends recommended me using getline, tokenize each line, and then 
  convert string to integer, but I was wondering if there are easier ways of doing it
  without having to change the type (int to string, string to int) back and forth.</p>
  
  <p>Any help would be greatly appreciated.</p>