I am writing a program for a class that computes tuition for students. I am getting an infinite loop and cant seem to find why?
Code:
#include <iostream>
#include <string>
#include <fstream>  
#include <iomanip>
using namespace std;
int main ()
{
    string ssn;
    char resident;
    int count = 0, hours;
    double feesOther = 30, feesTech = 18, tuition, totalFees, sumTuition = 0, subTuition;
    ofstream printFile ("StudentGrades.txt");
    if (!printFile) 
    {
        cout << " Error opening printFile" << endl;
        system ("pause");
        return 100; 
    }
    ifstream studentFile;
    studentFile.open("c:\\lab5b.dat");
    if (!studentFile)
    {
        cout << "Open error on lab5a.dat" << endl;
        system ("pause");
        return 101;
    }
    studentFile >> ssn >> resident >> hours;
    cout << "SSN          Tuition\n";
    cout << "--------------------\n";
    while (!studentFile.eof())
    {
        if (resident == 'Y' || resident == 'y')
        {
            if (hours >= 12)
                tuition = 1548;
            else
                tuition = hours * 129;
        }   
        if  (resident == 'N' || resident == 'n')
        {
            if (hours >= 12)
                tuition = 6360;
            else
                tuition = hours * 530;
        }   
        totalFees = feesOther + (hours * feesTech);
        if (totalFees > 112.50)
            totalFees = feesOther + 112.50;
        subTuition = tuition + totalFees;
        sumTuition += tuition ;
        count++;
        cout << ssn << setw(7) << showpoint << setprecision(2) << subTuition << endl;
        cout << "Total Semester Tuition: " << sumTuition << endl;
        studentFile >> ssn >> subTuition;
    }
    studentFile.close();    
    printFile.close();      
    system ("pause");
}
 
     
     
    