🎯 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++.
\uD83D\uDDD2 Requirements
Create a set of integer values using the
std::set<int>
container class in C++.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
setSize()
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.
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:
Full source code (.cpp files or .txt files)
Screenshot of the Console with the code executing