/* Filename: ramlist.cpp Programmer: Br. David Carlson Date: October 7, 1997 Last Modified: December 2, 2001 Modified: July 17, 2000 to use modern headers. This program is simply a test program that tries out some of the functions of the LstTableClass and presents the results on the screen. Tested with: Microsoft Visual C++ 6.0 Microsoft Visual C++ .NET g++ under Linux */ #include "lsttable.h" int main(void) { LstTableClass Table; ItemType Temp, Item; int k, Digit; long Key; float Data; if (Table.Empty()) cout << "Table is empty (correct)" << endl; else cout << "Table is not empty (incorrect)" << endl; for (k = 0; k < 7; k++) { Digit = k + 1; Key = Digit * 100 + (Digit + 1) * 10 + (Digit + 2); Data = Key / 10.0; cout << "Inserting an Item with KeyField of " << Key << " and DataField " << Data << endl; Temp.KeyField = Key; Temp.DataField = Data; Table.Insert(Temp); } cout << endl; if (Table.Empty()) cout << "Table is empty (incorrect)!" << endl; else cout << "Table is not empty (correct)" << endl; if (Table.Retrieve(345, Item)) cout << "Data field for 345 contains " << Item.DataField << endl; else cout << "Item 345 not found" << endl << endl; if (Table.Retrieve(789, Item)) cout << "Data field for 789 contains " << Item.DataField << endl; else cout << "Item 789 not found" << endl << endl; return 0; }