//  2004.11.05
//  Lab #9 - ListType.cpp


#include "ListType.h"
#include <iostream>

using namespace std;

ListType::ListType()
{
  head = tail = NULL; 
}

void ListType::append(int x)
{
 NodeType *p;
 p = new NodeType;
 p->info = x;
 p->next = NULL;

 if(head == NULL)
 {
   head = tail = p;
   tail->next = NULL;
  }
 else
   tail->next = p;
 
   tail = p;
   tail->next = NULL; 
}

void ListType::print()
{
  NodeType *p = new NodeType;
  p = head;
  while(p != NULL)
  {
    cout << p->info << endl;
    p = p->next;
  }
}

