#include #include "Set.H" #include "Map.H" void main() { int numbers[] = { 2, 4, 6, 8, 10 }; int moreNumbers[] = { 111, 888, 333, 666 }; char* names[] = {"Alan", "Betty", "Cal", "Dotty"}; char* moreNames[] = {"Elm", "Fignewton", "Gregorian", "Horticulture"}; cout << "Constructing some sets: \n" << endl; Set a; Set b (1); Set c (1, 12); Set d (numbers, 5); cout << "Set A = " << a; cout << "Set B = " << b; cout << "Set C = " << c; cout << "Set D = " << d; cout << "\nConstructing some maps: \n" << endl; Map e; Map f; Map g (numbers, names, 4); Map h (moreNumbers, names, 4); Map i (moreNumbers, names, 4); Map j (moreNumbers, moreNames, 4); cout << "Map E = " << e; cout << "Map F = " << f; cout << "Map G = " << g; cout << "Map H = " << h; cout << "Map I = " << i; cout << "Map J = " << j; cout << "\nTesting GetValue() function: \n" << endl; char *temp; temp = e.GetValue (1); cout << "In Map E, Value for Key = 1 is " << (temp == NULL ? "(null)" : temp) << endl; temp = g.GetValue (1); cout << "In Map G, Value for Key = 1 is " << (temp == NULL ? "(null)" : temp) << endl; temp = h.GetValue (111); cout << "In Map H, Value for Key = 111 is " << (temp == NULL ? "(null)" : temp) << endl; temp = j.GetValue (666); cout << "In Map J, Value for Key = 666 is " << (temp == NULL ? "(null)" : temp) << endl; cout << "\nTesting Equality: \n" << endl; cout << "E " << (e == e ? "IS" : "is NOT") << " equal to E" << endl; cout << "E " << (e == f ? "IS" : "is NOT") << " equal to F" << endl; cout << "H " << (h == i ? "IS" : "is NOT") << " equal to I" << endl; cout << "I " << (i == h ? "IS" : "is NOT") << " equal to H" << endl << endl; cout << "E " << (e == g ? "IS" : "is NOT") << " equal to G" << endl; cout << "G " << (g == i ? "IS" : "is NOT") << " equal to I" << endl; cout << "I " << (i == j ? "IS" : "is NOT") << " equal to J" << endl; cout << "\nTesting Copy Constructor: \n" << endl; Map k = e; Map l = h; Map m = j; cout << "Map K (Copy of E) = " << k; cout << "Map L (Copy of H) = " << l; cout << "Map M (Copy of J) = " << m; cout << "\nTesting Assignment: \n" << endl; k = j; l = m; m = h; cout << "After assigning J to K, Map K = " << k; cout << "After assigning M to L, Map L = " << l; cout << "After assigning H to M, Map M = " << m; cout << "\nEnd of Program" << endl; }