title: How to separate a line of input into multiple variables?
body: <p>I have a file that contains rows and columns of information like:</p>
  
  <pre><code>104857 Big Screen TV  567.95
  573823 Blender         45.25
  </code></pre>
  
  <p>I need to parse this information into three separate items, a string containing the identification number on the left, a string containing the item name, and a double variable containing the price. The information is always found in the same columns, i.e. in the same order.</p>
  
  <p>I am having trouble accomplishing this. Even when not reading from the file and just using a sample string, my attempt just outputs a jumbled mess:</p>
  
  <pre><code>string input   = "104857 Big Screen TV  567.95";
  string tempone = "";
  string temptwo = input.substr(0,1);
  tempone += temptwo;
  for(int i=1 ; temptwo != " " &amp;&amp; i &lt; input.length() ; i++)
  {
    temptwo = input.substr(j,j);
    tempone += temp2;
  }
  cout &lt;&lt; tempone;
  </code></pre>
  
  <p>I've tried tweaking the above code for quite some time, but no luck, and I can't think of any other way to do it at the moment.</p>