How?
As any other function. Make a void function that takes one argument - constant reference to set.
Where?
Outside of main function (again, as any other function)
#include <iostream>
#include <unordered_set>
using namespace std;
class myclass
{
public:
void myfunc(unordered_set temp)
{
for (int el : temp)
{
cout << el << "\n";
}
}
};
int main()
{
unordered_set<int> temp = {12, 23, 0, -4, 45, 34};
myclass myobj;
cout << "The original elements are:\n";
myobj.myfunc(temp);
cout << "Elements after adding a single value:\n";
temp.insert(66);
for (auto el : temp)
{
cout << el << "\n";
}
cout << "Elements after adding multiple values:\n";
temp.insert({16, 14, -25});
for (auto el : temp)
{
cout << el << "\n";
}
cout << "Elements after deleting a single value:\n";
temp.erase(12);
for (auto el : temp)
{
cout << el << "\n";
}
return 0;
}