title: How can I get the sum of integers in a text file with c++?
body: <p>I apologize if this is a simple question, I'm teaching myself c++ and can't seem to find the solution I'm looking for to this one anywhere.</p>
  
  <p>Say I have a text file with data organized like this:</p>
  
  <p>10 - sample 1</p>
  
  <p>20 - sample 2</p>
  
  <p>30 - sample 3</p>
  
  <p>40 - sample 4</p>
  
  <p>Is there a way I can get the numbers from each line and store their sum in a variable? Or am I approaching this incorrectly?
  Thanks in advance!</p>