Printing an unsorted list
I've run into a problem trying to print this list. I'm getting the list from a text file and loading it item by item like this
Code:
#include <fstream>
using namespace std;
const int MAX_LENGTH = 50;
typedef int ItemType;
class List
{
public:
List(); //Default constructor
void GetList(ifstream&);
bool IsEmpty();
bool IsFull();
int LengthNow();
void Insert(ItemType item);
void Delete(ItemType item);
bool IsPresent(ItemType item);
void SelSort();
void Print();
private:
int length;
ItemType data[MAX_LENGTH];
};
Code:
void List::GetList(ifstream& infile)
{
ItemType item;
while(infile)
{
data[length] = item;
infile >> item;
length++;
cout << endl;
}
}
The list looks something like:
1492
1066
1917
1848
1367
How in the world can I get this list to fully print?
Code:
void List::Print()
{
??????
}