Assign20 3
Assign20 3
Assignment 3 – Arrays
April 7, 2021
Objectives
Practice and get familiar with functions and arrays in C language. In this assignment you will make use
of the subject matters in Chaps 4 and 5.
Problem Description
1. (50%) Write a program using one-dimensional arrays to find the union and intersection of sets.
Read in two sets of numbers, each having 10 random numbers. After reading all values, display
the following numbers. You must use the smallest possible array to solve the problems.
(a) (union) all the unique elements in the collection of both sets of numbers;
(b) (intersection) the unique elements common to both sets of numbers.
Example:
Input Set 1: 1 2 6 8 15 16 17 18 23 24
Input Set 2: 2 5 7 8 12 13 15 16 21 23
-> Union: 1 2 5 6 7 8 12 13 15 16 17 18 21 23 24
-> Intersection: 2 8 15 16 23
1
Requirements
You MUST use
1. C style!
2. I/O functions
3. Flow of control
4. Functions
5. Arrays
Evaluation
• Correctness: 90%
• Styling: 10%
Submission
• 2021.04.18 (degrade by 10 points for each day delay)
• Source code (assign1.c, assign2.c)
– Show your information (Name, Student ID, Dept) as comments in the beginning of your code.
– Zip and upload the files to eeclass.