title: getline() and reading data from text files
body: <p>The program I code below should 
  List all payment made by each student, show amount paid and outstanding</p>
  
  <p>I need some help with the following section:</p>
  
  <pre><code>void payment()
  {
      // Display message asking for the user input
      std::cout &lt;&lt; "List all payment made by each student, show amount paid and outstanding." &lt;&lt; std::endl;
  
      // Read from text file and Display list of payment
  
      std::ifstream infile;               // enable to open, read in and close a text file
      float StudentCode;                  // to store the student enrolment number
      float Amount;                       // to store the amount of money
      float Type;                         // to store information on type of payment made
      float Outstanding;                  // to store amount of money is due
  
      infile.open("Payment.txt");         // open a text file called Payment
  
      if (!infile)                 
      {
          std::cout &lt;&lt; "Item list is empty" &lt;&lt; std::endl;     // if the file is empty it output the message
      } 
      else 
      {
          std::cout &lt;&lt; "List of Payment: " &lt;&lt; std::endl;
          std::cout &lt;&lt; "" &lt;&lt; std::endl;
          std::cout &lt;&lt; "Enrolment No." &lt;&lt; "Amount" &lt;&lt; "Outstanding" &lt;&lt; std::endl;
  
          // If there is Student Code that has the same number, it need to combined the amount it paid 
          // For an example 
          // Student Code: 12 Amount: 25
          // Student Code: 12 Amount: 50
          // so it should display the following when the program runs:
          // Student Code: 12 Amount: 75
  
          while(!infile.eof())            // output the description of the text file onto the screen
          {
              getline(infile,StudentCode,Amount);
  
              Outstanding = Amount - 100;
  
              std::cout &lt;&lt; StudentCode &lt;&lt; Amount &lt;&lt; "$" &lt;&lt; Outstanding &lt;&lt; std::endl;
              //iter++;
          }
          std::cout &lt;&lt; "End of list\n" &lt;&lt; std::endl;
      }
  
      infile.close();         // close the text file  
  }
  </code></pre>
  
  <p>What is wrong with the getline part:</p>
  
  <pre><code>getline(infile,StudentCode, Amount);
  </code></pre>
  
  <p>Also the program should not display repeated Student Code but combine the amount it paid.
  Where I explain in the comment section</p>
  
  <pre><code>// If there is Student Code that has the same number .....
  </code></pre>
  
  <p>How do I do this?</p>