#include
using namespace std;
//交集
void Intersection(int a[], int b[], int m, int n)
{
cout
for(int i = 0; i
for(int j = 0; j
if(a[i] == b[j])
break;
}
//並集
void AddSets(int a[], int b[], int m, int n)
int flag;
flag = true;
flag = false;
if(flag) cout
//差集
void SubSets(int a[], int b[], int m, int n)
void main()
int n1;
int n2;
int a[100];
int b[100];
cin>>n1;
for (int i = 0; i
cin>>a[i];
cin>>n2;
for (i = 0; i
cin>>b[i];
Intersection(a, b, n1, n2);
AddSets(a, b, n1, n2);
SubSets(a, b, n1, n2);
getchar();
#include
#include
#include
using namespace std;
//交集
void Intersection(int a[], int b[], int m, int n)
{
cout
for(int i = 0; i
{
for(int j = 0; j
{
if(a[i] == b[j])
{
cout
break;
}
}
}
cout
}
//並集
void AddSets(int a[], int b[], int m, int n)
{
int flag;
cout
for(int i = 0; i
{
flag = true;
for(int j = 0; j
{
if(a[i] == b[j])
{
flag = false;
break;
}
}
if(flag) cout
}
for(int j = 0; j
{
cout
}
cout
}
//差集
void SubSets(int a[], int b[], int m, int n)
{
int flag;
cout
for(int i = 0; i
{
flag = true;
for(int j = 0; j
{
if(a[i] == b[j])
{
flag = false;
break;
}
}
if(flag) cout
}
cout
}
void main()
{
int n1;
int n2;
int a[100];
int b[100];
cout
cin>>n1;
cout
for (int i = 0; i
{
cin>>a[i];
}
cout
cin>>n2;
cout
for (i = 0; i
{
cin>>b[i];
}
Intersection(a, b, n1, n2);
AddSets(a, b, n1, n2);
SubSets(a, b, n1, n2);
getchar();
}