CIS 223
Assignment Number 4-S97

Pointers, Arrays, Structs, Argument Passing the C way
Templates in C (using void *)

Reading: This assignment is intended to help you review what we have learned about the following topics: It is suggested that you: Programming: (An individual project)

A. We have constructed a text file containing a collection of structs each of which is made up of 4 fields:

This information is stored on a file named sort.dat in the board directory c223sxx. The board is made up of a character string of max length 6 followed by three integers, but you are to treat one of the integers as an enumerator value whenever you print the contents of a struct. NOTE: The information stored in the file is actually part of the symbol table generated by an assembler for a simple, hypothetical assembly language program, but this is of no concern for this particular problem.

You are to write a program which reads all of the symbol table entries (all of the structs) into memory and sorts them using the qsort routine in the C++ library. Your program should print the struct data as it is read in and then reprint it after the sort. The information in each struct should be printed on a single line (in four columns with appropriate descriptive headers).

Turn In: Listing of a successful run of your program with the output described above.

Due Date: To be determined.

B. Programming (also an individual project) -- Redo the Dice Simulation Program using standard C argument passing and standard C I/O.

Turn In: Just the revised program and its output.

Due Date: To be determined.

CIS 223 Sample Data for Assignment 4-S97 (Part A ONLY):

          LDAC
          11 
          1
          5
          RNUM
          41
          1
          2
          SUM
          898
          1
          3
          LOOP
          881
          1
          1
          STAC
          12
          1
          6
          AVERAG
          897
          1
          2
          PNUM
          42
          1
          2
          ZERO
          892
          0
          2
          ONE
          893
          1
          6
          ADD
          21
          1
          2
Return to Previous Page