/* File: main6s.C

   Using the new C++ list ADT with student records
*/

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "list6.h"

main() {
   List *L ; 
   position pos ;
   ListItem *iptr ;

   printf("Make new list\n") ;
   L = new List ;

   L->Append(ListItem(1234567, "John Smith", "CMSC")) ;
   L->Append(ListItem(24681012, "Jane Doe", "CMSC")) ;
   L->Prepend(ListItem(135791113, "Joe Blow", "CMSC")) ;
   L->Prepend(ListItem(314316598)) ;
   L->Prepend(ListItem(874310457)) ;
   L->Print() ; 

   printf("\nSearch for\n") ;
   pos = L->Locate(ListItem(1234567)) ;
   iptr = L->ItemAt(pos) ;
   printf("Found: ") ;
   iptr->print() ;
   printf("\n") ;
   delete iptr ;

   printf("\nDelete item\n") ;
   L->Delete(pos) ;
   L->Print() ;


   printf("\nDelete List\n") ;
   delete L ;
}
