/* -------------------------------------------------------------------------- */ /* Spring 2004 CSCI 2720 Prog. Proj. #1 part I */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* ifaceP1.cc */ /* main program to test interface to UList< > class */ /* -------------------------------------------------------------------------- */ /* If the Project #1 interface is correctly implemented in your ulist.h and ulist.cc files, then this file should compile with the command g++ -o ifaceP1 ifaceP1.cc Once it compiles, the output is self-explanatory, i.e., the outputs of the various member functions should match exactly the outputs predicted by the text directed to cout. Note that this is not an exhaustive test of all the functionality required by the project, or even of the interfaces to all of the public member functions. However the functions used are representative. */ #include "ulist.cc" int mycmp(char* const &s1, char* const &s2) { return strcmp(s1, s2); } int main( ) { UList ulint; cout << "should be: 1 1 1 0" << endl; cout << " "; cout << ulint.Insert(9); cout << ' ' << ulint.Insert(5); cout << ' ' << ulint.Insert(13); cout << ' ' << ulint.Insert(2 + 3) << endl; UList ulstr(&mycmp); cout << "should be: 1 0 1 1 1 1 1 0" << endl; cout << " "; cout << ulstr.Insert("far!"); cout << ' ' << ulstr.Remove("It"); cout << ' ' << ulstr.Insert("well"); cout << ' ' << ulstr.Insert("so"); cout << ' ' << ulstr.Insert("works"); cout << ' ' << ulstr.Insert("It"); cout << ' ' << ulstr.Remove("well"); cout << ' ' << ulstr.Insert("so") << endl; return 0; } // end of main( )