Lab 2 - Sets Lab

 Objective

Design and implement a program to perform set operations in C++ using sets. This lab will help you understand the concept of sets, their structure, and their usage in C++.

 Requirements

  1. Create a set of integer values using the set<int> container class in C++.

  2. Add the following methods to the program:

    • A method called setInsert() that takes an integer value as a parameter and adds it to the set.

    • A method called setRemove() that takes an integer value as a parameter and removes it from the set.

    • A method called setContains() that takes an integer value as a parameter and returns a boolean value indicating whether the set contains the value or not.

    • A method called getSize() that returns the number of elements in the set.

    • A method called setPrint() that prints the elements of the set in ascending order.

    • A method called setUnion() that takes another set as a parameter and returns the union of the sets.

  3. In the main() function, demonstrate the usage of the set operations. Create a set of integer values, perform the set operations using the methods you created, and display the results of each operation.

Deliverable

Upload the following:

  1. Full source code (.cpp files or .txt files)

  2. Screenshot of the Console with the code executing

2024 - Programming 3 / Data Structures - Author: Dr. Kevin Roark