I thought I had this program licked and moved on to fixing the next problems, then ran it again and found out my while loop isn't doing anything. It goes into my loop, stops, and doesn't do anything else. If there was one item, it should move on to the next function which tells what the length is, but I'm getting nothing. Just a black screen that says "Hey" once and then a flashing cursor. (The 'Hey' is my test, not part of the program.)

I'm using a class called List for this program in case that helps in diagnosing the issue.

int main ()
{      ItemType element;
        List a;
        ifstream InData;
        InData.open ("int.dat");
            while (InData >> element)  
                   { a.Insert(element);
                     cout << "Hey" << endl; }   
        int length = a.Length();
        
        cout << "There are " << length << " many items in this list." << endl;
                
        a.Print();
         
        system ("pause");
        return 0; 
}
This question has already been answered. Start a new discussion instead.