Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CODING ASSIGNMENT SETS AND SET OPERATIONS SUBMISSION DATE: JULY 3, 2012 (5:30pm) Specifications: - Create a C program that

t accepts two (2) sets of numbers from the user. After which, apply the following operations to the sets: o Cardinality o Union o Intersection o Difference (A-B only) o Cartesian Product - The maximum number of elements (not cardinality) per set is just five (5). - For easier handling, elements should be numbers (0-9) only. - For naming standardization, denote the first set as set A and the second as set B - Your output must be the same with this sample run: # of elements for set A: 4 (<-User input here) # of elements for set B: 3 (<-User input here) Element 0 for set A: 1 (<-User input/s here) Element 1 for set A: 2 (<-User input/s here) Element 2 for set A: 3 (<-User input/s here) Element 3 for set A: 4 (<-User input/s here) Element 0 for set B: 3 (<-User input/s here) Element 1 for set B: 4 (<-User input/s here) Element 2 for set B: 5 (<-User input/s here) Cardinality for A: 4 Cardinality for B: 3 Union: A U B = {1, 2, 3, 4, 5} Intersection: A ^ B = {3, 4} Difference: A B = {1, 2} Cartesian Product: AxB = {null, (1,3), (1,4), (1,5), (2,3), (2,4), (2,5), (3,3), (3,4), (3,5), (4,3), (4,4), (4,5)} Note: - Your program must have error handling (e.g more than 5 numbers/letters inputted) - Intersection will just be denoted as ^ - Just use a single file for this assignment - Filename is cmsc55_code1_lastname_firstletteroffirstname.c

edvg

You might also like