I need to find the difference of 2 sets. below are my functions for the union and intersection of sets in my driver-file. Is the difference set a combination of the two?

IntegerSet IntegerSet::unionOfSets(IntegerSet b)
{
	IntegerSet c;

	for ( int i = 0; i < 101; i++ ) 
	{
		if ( set[i] || b.set[i] )
		c.set[i] = 1;
	}

	return( c );
}

IntegerSet IntegerSet::intersectionOfSets(IntegerSet b)
{
	IntegerSet d;
 
	for ( int i = 0; i < 101; i++ ) 
	{
		if ( set[i] && b.set[i] )
		d.set[i] = 1;
	}
 		return( d );
}

Are you having a problem you're not telling us or just asking a strange question that's hard to decipher?

Are you having a problem you're not telling us or just asking a strange question that's hard to decipher?

im asking what the function would look like for the difference of sets

In your code:
The union uses OR
The intersection uses AND
I believe you'll find the difference uses XOR

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.