// Using the given code for ItemType.h, ItemType.cpp, Unsorted.h and Unsorted.cpp and below 2 files for driver:
// Driver 1
#include <iostream>
#include "ItemType.h"
#include "Unsorted.h"
using namespace std;
int main(void) {
Unsorted UL;
ItemType IT;
ItemType IT2;
IT.Initialize(5);
bool TestF = UL.IsFull();
// this should be TestF not Test
cout << TestF << endl; //should print 0 :false
UL.InsertItem(IT);
UL.InsertItem(IT2);
cout << UL.LengthIs() << endl;//should print 2
system("pause");
}
// end of Driver 1
// Driver 2:
#include <iostream>
#include "ItemType.h"
#include "Unsorted.h"
using namespace std;
int main(void) {
Unsorted UL;
// Create an ItemType called MyDay and initialize it with your day of birth and put it in the list UL.
ItemType MyDay;
MyDay.Initialize(10);
UL.InsertItem(MyDay);
// Create an ItemType called MyMonth and initialize it with your month of birth and put it in the list UL.
ItemType MyMonth;
MyMonth.Initialize(7);
UL.InsertItem(MyMonth);
// Create an ItemType called MyYear and initialize it with your year of birth and put it in the list UL.
ItemType MyYear;
MyYear.Initialize(1995);
UL.InsertItem(MyYear);
// Create an ItemType called MyT and initialize it with the last four digits of your TNumber and store it in UL.
ItemType MyT;
MyT.Initialize(4017);
UL.InsertItem(MyT);
// Call the member function LengthIs() and display the length of the list after all these insertions.
cout << "Length: " << UL.LengthIs() << endl;
// display the elements in list
cout << "List: " <<endl;
UL.ResetList(); // reset list
ItemType item;
// loop over the list, displaying elements
for(int i=0;i<UL.LengthIs();i++)
{
UL.GetNextItem(item); // get next item in item
item.Print(); // display item
}
bool found;
// call the member function RetrieveItem() to retrieve your month of birth.
UL.RetrieveItem(MyMonth, found);
// display found or not found based on found value
if(found)
cout << "Found" << endl;
else
cout << "Not found" << endl;
// call the member function DeleteItem() to delete your Tnumber digits.
UL.DeleteItem(MyT);
// Display the elements of the list after this deletion.
cout << "List: " <<endl;
UL.ResetList(); // reset the list
// loop over the elements of the list, displaying elements
for(int i=0;i<UL.LengthIs();i++)
{
UL.GetNextItem(item);
item.Print();
}
system("pause");
return 0;
}