I am trying to read from a file using a while loop and I am stuck as to why it keeps looping forever. I think it has something to do with my while loop condition but I am unable to figure it out.
#include <iostream>
    #include <fstream>
    #include <cstdlib>
    
    using namespace std;
    
    int main()
    {
        string name;
        int age, favNum;
        
        ifstream inFile;
        inFile.open("Trial.txt");
        if(inFile.fail())
        {
            cout << "No Such File!" << endl;
            exit(100);
        }
        
        cout << "The names are: " << endl;
        while(!inFile.eof())
        {
            getline(inFile, name);
            cout << name << endl;
            
            inFile >> age;
            cout << age << endl;
            
            inFile >> favNum;
            cout << favNum << endl;
            
            inFile.ignore(100, '\n');
        }
        
        inFile.close();
    }
Text File
Joe
10 12
Zoe
20 12
John
19 12
Harold
20 12
 
     
    