title: C++ Store a Map Pair with data from a text file
body: <p>I have a text file that is storing a baseball player id and that players rbi (runs batted in) totals.  The ids are all four digits and the rbis range from 60 to 110.  It looks like this.</p>
  
  <p>5554 102 87 63 90                                                                       5553 66 68 90 102
  etc...</p>
  
  <p>I wrote some code to store the ids in a set, calculate the average of the four rbi totals from the text file, and output the results to the console.  My homework assignment says that I have to store the player id and rbi average to a map pair, not a set.  I thought I read on that the syntax for the mapped pair is </p>
  
  <pre><code>typedef pair&lt;const Key, T&gt; value_type;
  </code></pre>
  
  <p>but I am having trouble rewriting this code with a mapped pair.  Any thoughts?</p>
  
  <pre><code> #include &lt;iostream&gt;
   #include &lt;fstream&gt;
   #include &lt;set&gt;
  
   using namespace std;
   int main() 
   {
      ifstream input("filepath\\*.txt");
      multiset&lt;int&gt; values;
  
      // Read data from file 
      for(unsigned int j = 1; j &lt;= 4; j++)
      {
      int player;
      (input &gt;&gt; player);
  
      int rbi;
      double total = 0.0;
      double average = 0.0;
          for(unsigned int i = 1; i &lt;= 4; i++)
          {
          // Compute the average. 
          (input &gt;&gt; rbi);
          values.insert(rbi);
          total += rbi;
          average = total/4;
          }
  
      //Output totals to console
      cout &lt;&lt; player;
      cout &lt;&lt; " " &lt;&lt; average &lt;&lt; endl;
      }
  
   system("Pause");
   return 0;
   }
  </code></pre>