Sunteți pe pagina 1din 3

#include <iostream>

using namespace std;


int c,bi,m;
void in(int a[10],int b[10]);
void un(int a[10],int b[10]);
void cricket(int ci[10],int b[10]);
void badminton(int ci[10],int b[10]);
void nor(int a[10],int b[10],int ci[10]);
int main() {
int i;
int cl[100];
int crk[100];
int b[100];

cout<<"enter size of class";


cin>>m;
cout<<"enter roll nos";
for(i=0;i<m;i++)
{
cin>>cl[i];
}
cout<<"enter no of who play cricket";
cin>>c;
for(i=0;i<c;i++)
{
cin>>crk[i];

}
cout<<"enter no of who play badminton";
cin>>bi;
for(i=0;i<bi;i++)
{
cin>>b[i];

in(crk,b);
un(crk,b);
cricket(crk,b);
badminton(b,crk);
nor(cl,crk,b);
return 0;

}
void in(int a[10],int b[10])
{
int i,j;
cout<<"intersection"<<endl;
for(i=0;i<c;i++)
{
for(j=0;j<bi;j++)
{

if(a[i]==b[j])
{
cout<<a[i]<<endl;
}
}

}
void un(int a[10],int b[10])
{
int i,j,temp=0;
cout<<"union"<<endl;
for(i=0;i<c;i++)
{
for(j=0;j<bi;j++)
{
if(a[i]==b[i])
{
temp=1;
}
}
if(temp==0)
{
cout<<a[i]<<endl;
}
temp=0;
}

for(j=0;j<bi;j++)
{
cout<<b[j]<<endl;
}
}

void cricket(int ci[10],int b[10])


{
int i,j,temp=0;
cout<<"only cricket"<<endl;
for(i=0;i<c;i++)
{
for(j=0;j<bi;j++)
{
if(ci[i]==b[j])
{
temp=1;
}

}
if(temp==0)
{
cout<<ci[i]<<endl;
}
temp=0;
}

}
void badminton(int ci[10],int b[10])
{
int i,j,temp=0;
cout<<"only badminton"<<endl;
for(i=0;i<c;i++)
{
for(j=0;j<bi;j++)
{
if(ci[i]==b[j])
{
temp=1;
}

}
if(temp==0)
{
cout<<ci[i]<<endl;
}
temp=0;
}
}
void nor(int a[10],int b[10],int ci[10])
{
int i,j,k,temp=0;
cout<<"who dont play anything"<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<c;j++)
{
for(k=0;k<bi;k++)
{
if(a[i]==b[j])
{
temp=1;
}
if(a[i]==ci[k])
{
temp=1;
}
}
}
if(temp==0)
{
cout<<a[i]<<endl;
}
temp=0;
}
}

S-ar putea să vă placă și