title: Find string in txt file and get the following number
body: <p>I'm having an issue with my code, it is finding the string I want but it is returning the whole line. I want it to return just the part of the string I input and return the following number amount. As of now, it is finding "Tank 7000.99" rather than just "Tank" and it is not returning the following number of 7000.99. The info is located in a text file.</p>
  
  <p><strong>Text File:</strong></p>
  
  <pre><code>Tank 7000.99
  Cart 900.99
  </code></pre>
  
  <p><strong>Problem Area</strong></p>
  
  <pre><code>double getCost(string item) {      //string item = "Tank"
      string str;
      double cost;
      while (getline(file, item)) 
      {
          if (std::size_t pos = str.find(item))
          {
              cout &lt;&lt; "Found " &lt;&lt; item &lt;&lt; endl;
              file &gt;&gt; cost;                      //file is the txt file
          }
          else
          {
              cout &lt;&lt; "Item not found in file" &lt;&lt; endl;
              cost = 0;
          }
      }
      return cost;
  }
  </code></pre>