#include #include "list.h" using namespace std; void add_with_comment(List & L, int i) { cout << "Inserting " << i << endl; L.Insert(i); } void del_with_comment(List & L, int i) { cout << "Deleting " << i << endl; L.Delete(i); } void print_with_comment(List L) { cout << "The List is : " << endl; L.Print(); cout << endl; } void check_with_comment(List L, int i) { if (L.IsPresent(i)) { cout << i << " is in the list." << endl; } else { cout << i << " is Not in the list." << endl; } } int main () { List L; int i; cout << "Here is the datastructure " << endl; cout << endl << endl; add_with_comment(L,3); add_with_comment(L,2); add_with_comment(L,5); add_with_comment(L,1); print_with_comment(L); del_with_comment(L,1); print_with_comment(L); del_with_comment(L,5); print_with_comment(L); cout << "Inserting 1, 5, 4,7,9 " << endl; L.Insert(1); L.Insert(5); L.Insert(4); L.Insert(7); L.Insert(9); print_with_comment(L); check_with_comment(L,0); check_with_comment(L,6); check_with_comment(L,10); check_with_comment(L,1); check_with_comment(L,2); check_with_comment(L,3); check_with_comment(L,4); check_with_comment(L,5); check_with_comment(L,7); check_with_comment(L,9); cout << endl; del_with_comment(L,3); print_with_comment(L); del_with_comment(L,1); del_with_comment(L,5); del_with_comment(L,9); print_with_comment(L); }