I have an assignment to use templates for a linked sorted list. The SortedType.h file is in our book and that is what we have to change. I understand how to do all of that and it compiles and everything. When I create a driver to test it, I just get errors. I created a .dat file with a list of integers to test. I'm simply trying to copy those numbers into my intList display them. If I put a cout num at the end, the last item it my list just displays as many times at the length of the list is. I have done similar assignments but never had this problem. Something is required in the GetNextItems() but not really sure what it is. This should be something real simple and I am making this way to difficult. If you need to see ItemType.h, I can post that up too. Thanks in advance!
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include "SortedType.h"
using namespace std;
int main()
{
int num = 0;
SortedType<int> intList;
SortedType<string> stringList;
ifstream inFile;
inFile.open("assignment4int.dat");
while(!inFile.eof()){
inFile >> num;
intList.InsertItem(num);
}
intList.ResetList();
for(int i=0; i<intList.GetLength(); i++)
cout << intList.GetNextItem() << endl;
}