CIS 1057: Homework 9

Handed out: 10/26/2010
Due: by 10:00am on 11/01/2010
Email program to TA

Your program defines 3 functions

  1. void printUnion(int na, char *a[na], int nb, char *b[nb])
    which prints out without repetion all the string that appear in either a or b. You can assume that in a (same for b) no string appears twice.
  2. void printIntersect(int na, char *a[na], int nb, char *b[nb])
    which prints out without repetition the elements that appear in both a and b. You can assume that in a (same for b) no string appears twice.
  3. void printdiff(int na, char *a[na], int nb, char *b[nb])
    which prints out without repetion the elements that are in a but not in b. You can assume that in a (same for b) no string appears twice.

To test your functions use the following two lists of words:
A: {"rose", "ann", "jim", "sam", "joe", "SUE", "anne", "samuel"};
B: {"jim", "albert", "bert", "sue", "james"};
Your program should work with capital and lowercase letters and treat them alike (i.e. "Sue" is the same as "SUE", of "sue", ..)

You may decide to sort the lists first and then form unions, intersections, and set differences.
Optionally you can split your program into 3 files, homework9.c, containing the main program, functions.c, containing the implementation of the functions you use, and functions.h containing the headers of the functions defined in functions.c and may be constants.