/*********************************************** Name: Russell Madsen* Date: April 2, 2007* Assignment: Project 6: Sets ************************************************ main.cpp should get the user input for the* two sets (you may want to use the strtok * function). It should two create two pointers * to Set objects (using "new") to hold the values. * It should add elements to each set, print the * sets, and then ask the user whether to find the * union or intersection between the sets. It * should print the result of the union or * intersection, and then release the space for * the objects.***********************************************/#include "Set.cpp"#include <iostream>using namespace std;int main(int argc, char* argv[]){ //vars// Set<int> *set1 = new Set<int>; Set<int> *set2 = new Set<int>; Set<int> *set3 = new Set<int>; char iu; char str[999]; char *result; const char delims[] = " ,.)("; //Set 1 cout << "Input Vector 1 (like num1, num2, ... , numN): "; cin.getline(str, 101); result = NULL; result = strtok( str, delims); while( result != NULL ) { set1->addVal(atoi(result)); result = strtok( NULL, delims ); } //Set 2 cout << "Input Vector 2 (like num1, num2, ... , numN): "; cin.getline(str, 101); result = NULL; result = strtok( str, delims); while( result != NULL ) { set2->addVal(atoi(result)); result = strtok( NULL, delims ); } //print the sets cout << "\nThe sorted sets are:" << endl; set1->printVec(); cout << endl; set2->printVec(); cout << endl; //intersect or union? cout << "Enter (i)ntersect or (u)nion: "; cin >> iu; switch(iu){ case 'i': cout << "Intersection:" << endl; set3 = set1->interSet(set2); set3->printVec(); break; case 'u': cout << "Union:" << endl; set3 = set1->unionSet(set2); set3->printVec(); break; default: cout<< "Enter A valid character(i or u)!" << endl; break; } delete set1, set2, set3; cout << set1->getPos() << " " << set2->getPos() << " " << set3->getPos() << endl; system("PAUSE"); return 0; }