\documentstyle[12pt]{report}
\pagestyle{myheadings}
\def\headlineaux{\sc Math 220/317: Programming II/Data Structures 
\hrulefill
}
\markboth{\headlineaux}{\headlineaux}

\newcommand{\assignmentNumber}{2}
\newcommand{\outdate}{25 September, 1992}
\newcommand{\duedate}{2 October, 1992}

\begin{document}
\begin{titlepage}\begin{centerline}{\Huge \framebox{Burt Rosenberg}}
\end{centerline}\end{titlepage}

\section*{Problem Set \assignmentNumber \hfill{\parbox{3in}
    {\small\sc\begin{flushright} Out: \outdate
     \\ Due: \duedate\end{flushright}}}}


\subsection*{Reading Assignment}
Read 
\begin{itemize}
\item Chapter 1;
\item Chapter 2, Sections ``Arrays'', 
``Records'' and ``Files'';
\item Chapter 3, Sections ``Preliminaries''
 and ``Programming with Linked Lists''.
\end{itemize}

\subsection*{Goals}
Practice using pointers, linked lists and text files.

\subsection*{Assignment}
Write and fully test a program that reads the text file {\em
datafile.dat} and places each word in a separate entry of a linked
list.  Once read, write the linked list to the terminal.
While reading {\em datafile.dat}, add new words to the list
at its head. In this way, when you write the list, the text
file appears with the words in reverse order.

I will give you a hint by writing the type definitions you
should use.
\begin{verbatim}
    const
      StringMax = 25 ;
    type
      StringArray = array [1..StringMax] of char ;
      StringType = record
                   str : StringArray ;
                   len : integer 
                   end ;

      ListPntr = ^ListType ;
      ListType = record
                   str : StringType ;
                   cnt : integer ;
                   next : ListPntr
                 end
\end{verbatim}
It is important to use subroutines to handle the creation
and manipulation of data types. Your code's structure must
be excellent to receive full credit. Among the subroutines
you must include will be,
\begin{verbatim}
    function read_string( var f : text ) : StringType ;
        {returns the next string in file f}
    procedure write_string( s : StringType ) ;
        {writes the string s to the terminal}
    function create_list : ListPntr ;
        {returns an empty list}
    function insert_head_list( l : ListPntr; 
        s : StringType; cnt : Integer ) : ListPntr ;
        {returns the new root pointer for the list l}
        {with a new element at its head.}
    procedure list_list( l : ListPntr ) ;
        {writes the entire list l to the terminal}
\end{verbatim}

Here are some helpful VMS hints. The file {\em login.com} contains
definitions what might make your life easier. As the course
progresses you will receive updates for this file including
new abbreviations for commands. At this moment, the file
defines the commands {\em home, cd} and {\em Rosenberg}.
The command {\em home} will take you back to the directory
you were in just after login. This is called your default or home
directory. The command {\em cd} is short for {\em set def}.
That is, you can now say {\em cd [.ps1]} instead of 
{\em set def [.ps1]}. The letters ``cd'' stand for ``change
directory''. Finally, if you want to send me mail, you must
use my login name ``E0L47V07''.
If you forget this eight character string, the command
{\em Rosenberg} will display it for you.
\end{document}
