CS270 Recitation 14: File I/O, Linked Lists

Goals

The Assignment

  1. Make a subdirectory called R14 for the recitation; all files should reside in this subdirectory.
  2. Copy data.txt to the R14 directory. It contains one line per student: Lastname,Firstname,GPA
    	    Smith,James,2.9
    	    Johnson,Mary,2.2
  3. Write a program that:
    1. Declares struct Node, a node in a dynamically-allocated linked list. Each node will contain the information for a single student, plus a pointer to the next struct Node.
    2. Opens data.txt
    3. Reads & parses the lines, via fscanf, into nodes of the linked list. Insert the nodes into the linked list in increasing GPA order.
    4. Closes the data file.
    5. Locate the student whose last name is “Applin”, and delete him from the linked list.
    6. Traverses the linked list, displaying the information in increasing GPA order.
    7. Free all the memory that was dynamically allocated.

Notes