#include "list.h" /* A tester to test the functions provided in strLists.c.*/ main() { nodep head, head1, head2; FILE *fp; printf("Step 1, test the initialization.\n"); head = (nodep)initialize(); printf("After Step 1, the list is: "); listprint(head); printf("Step 2, add strings to the list.\n"); addnode(head, "one"); addnode(head, "two"); addnode(head, "three"); addnode(head, "four"); addnode(head, "five"); addnode(head, "one"); addnode(head, "three"); printf("After Step 2, the list is: "); listprint(head); printf("Step 3: write the strings in the list to a file named HW2test.\n"); listwrite(head, "HW2test"); printf("The file is now: "); printfile("HW2test"); /*printf("Step 4: read from a file named list.h\n"); head = (nodep)listread("simple"); printf("After Step 4, the list is: "); listprint(head); */ /* Create atwo new lists and test concatenate.*/ printf("Step4: concatenate the lists.\n"); printf("List 1: "); listprint(head); head1 = (nodep)initialize(); addnode(head1, "three"); addnode(head1, "four"); addnode(head1, "five"); addnode(head1, "one"); addnode(head1, "two"); addnode(head1, "three"); addnode(head1, "four"); printf("List 2: "); listprint(head1); head2 = (nodep)initialize(); addnode(head2, "three"); addnode(head2, "four"); addnode(head2, "five"); addnode(head2, "one"); addnode(head2, "two"); addnode(head2, "three"); addnode(head2, "four"); printf("List 3: "); listprint(head2); concatenate(head, head1, head2); printf("After Step 4, the list is: "); listprint(head); printf("Step 5, sort the list.\n"); head = (nodep)quicksort(head); printf("After Step 5, the list is: "); listprint(head); }