Check subset,union,intersection,difference and disjoint between two arrays

#include<iostream>
#include<string>
using namespace std;

int main();
char arr[100];
char arrA[100];
char arrB[100];
void UniversalSet(string U)
{
char a;

cout << "Your Input:" << U << endl;
int len = U.length();
if(U[0]!= '{')
{
cout << "\nWRONG INPUT. Example:{H,3,l,l,0}\n";
main();
}
do{
for(int i=1;i<=U.length()-2;i++)
{
if (U[i]==',')
continue;
a = U[i] ;//<<' ';
arr[i] = a;
}

}while(0);
}
void SetA(string U)
{
char a;

cout << "Your Input:" << U << endl;
int len = U.length();
if(U[0]!= '{')
{
cout << "\nWRONG INPUT. Example:{H,3,l,l,0}\n";
main();
}
do{
for(int i=1;i<=U.length()-2;i++)
{
if (U[i]==',')
continue;
a = U[i] ;//<<' ';
arrA[i] = a;
}

}while(0);
}
void SetB(string str)
{
char a;

cout << "Your Input:" << str << endl;
//int len = str.length();
if(str[0]!= '{')
{
cout << "\nWRONG INPUT. Example:{H,3,l,l,0}\n";
main();
}
do{
for(int i=1;i<=str.length()-2;i++)
{
if (str[i]==',')
continue;
a = str[i] ;//<<' ';
arrB[i] = a;
}

}while(0);
}
int main()
{
string U,A,B;
int temp=0;
cout<<"Enter Input for Universal set U: "; getline(cin,U);
cout<<"Enter Input for set A: "; getline(cin,A);
cout<<"Enter Input for set B: "; getline(cin,B);
UniversalSet(U);
SetA(A);
SetB(B);


for(int i=1;i<100;i++)
{
cout << arr[i];
}
cout << endl;
for(int i=1;i<100;i++)
{
cout << arrA[i];
}
cout << endl;
for(int i=1;i<100;i++)
{
cout << arrB[i];
}




}



How can I check if the elements of arrA[] and arrB[] in arr[]?
If the elements of arrA[] and arrB[] is a subset of arr[] then how to check union,intersection,difference and disjoint between arrA[] and arrB[]?
Foo is a subset of Bar, if every member of Foo can be found from Bar.

You could look at http://www.cplusplus.com/reference/algorithm/set_union/
and related methods.

Topic archived. No new replies allowed.