#include #include #include "arlist.h" using namespace std; const int MAXCAP = 100; // storage capacity of list int main() { tNode list[MAXCAP+1]; // storage area list[0].next = NONE; // initialize "dummy" node int stored; // how many stored (n) int avail; // start of "free space" list char action; // Action code: ='I' insert, ='R' remove tItemType value; // Initialize by setting up the "free space" linked list init(list, stored, avail, MAXCAP); // Store input values in order in list cin >> action >> value; while (cin) { if (action=='I') insert(value, list, stored, avail); else if (action=='R') remove(value, list, stored, avail); cin >> action >> value; } // Print out the (ordered) list values cout << stored << " items stored:" << endl; traverse(list); // Reverse list and Print out the (reordered) list values tsil(list); cout << stored << " reversed items stored:" << endl; traverse(list); return 0; }