Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me out with this problem? Thanks! the picture posted is the fil

ID: 3676018 • Letter: C

Question

Can someone help me out with this problem? Thanks! the picture posted is the file to start off the problem then the problem is this...

*In this problem you will create a yset class to represent a set. (Note: C++ includes a set class, so to avoid confusion I named this class yset.)

Included in the set directory of this archive you will find: yset.h, a header file for a class to implement set numbers. Copy this file, unmodified, into your project.

Implement the methods described in the header file and a complete and thorough set of unit tests for this class.

Explanation / Answer

In your header file include two more lines:

set <int> st;

set <int>:: iterator it;

YSET.cpp

#include<iostream.h>

#include<conio.h>

#include<set.h>

#include "yset.h"

using namespace std;

yset :: yset()

{

st ={ };

}

yset :: size()

{

return st.size();

}

yset :: contains(value_type item)

{

it = st.find(item);

return 1;

else

return 0;

}

yset :: insert(value_type item)

{

st.insert(item);

}

yset :: remove( value_type item)

{

st.erase(item);

}

} //end of the class

Main.cpp

#include<iostream.h>

#include<conio.h>

#include<set.h>

using namespace std;

int main()

{

yset s;

int item;

set <int> st;

set<int> :: iterator it;

cout<<"number of times you want to perofrm operations";

int count;

cin>>count;

for(int i=0;i<count;i++)

{

cout<<"the size of set is:"<<s.size();

cout<<"enter the item to be inserted";

cin>>item;

s.insert(item);

cout<<"enter the item to be removed";

cin>>item;

s.remove(item);

}

for(it= st.begin(); it != st.end(); it++)

{

cout<<(*it)<<" ";

}

cout<<endl;

} //end of main fucntion

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote