title: Reading multiple data types on one line using C++
body: <p>I am attempting to pull from a dat file a date composed of ints as well as a char and a float value that are together. </p>
  
  <p>Dat file format looks like:</p>
  
  <pre><code>201205171200 M29.65
  201207041900 F30.3
  </code></pre>
  
  <p>And so on. </p>
  
  <p>I am struggling with separating these values. 
  Here is what I have so far:</p>
  
  <pre><code>    #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  
  using namespace std; 
  
  int main() {
      int inCount = 0; //This variable will be used to keep track of what record is being read.
      vector&lt;int&gt; dates;
      vector&lt;float&gt; temps;
      // Open and retrieve data from text.
      ifstream inFile; 
      inFile.open("biodata.dat");//Opening Biodata file to begin going through data
      if(inFile)
      {
          char tempType;
          while(!inFile.eof())
            {
              if (inFile.eof()) break;
              inFile &gt;&gt; dates[inCount];
              cout &lt;&lt; dates[inCount];
              inFile &gt;&gt; tempType;
              inFile &gt;&gt; temps[inCount];
                          if(tempType == 'F'){
                      temps[inCount] = (temps[inCount] - static_cast&lt;float&gt;(32)) * (5.0/9.0);
                  }
              inCount++;
  
            }
      } else {
          cout &lt;&lt; "The file did not load";
          return 0;
      }
  
  }
  </code></pre>
  
  <p>I need to separate the first part as a time stamp as an int. The char 'M' or 'F' needs to be its own char, and the the last bit needs to be a float. </p>
  
  <p>I have no idea how to pull them as their own variables. </p>