0% found this document useful (0 votes)
35 views3 pages

Asss 1

The document defines functions to input and output data about students enrolled in a class, who play cricket and badminton. It takes input of class size and student roll numbers, number of cricket and badminton players. It then calls functions to output the intersection, union, students who only play cricket, only badminton, and students who don't play any sport. The main function calls these output functions after taking the necessary input.

Uploaded by

pallavi-vetal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Asss 1

The document defines functions to input and output data about students enrolled in a class, who play cricket and badminton. It takes input of class size and student roll numbers, number of cricket and badminton players. It then calls functions to output the intersection, union, students who only play cricket, only badminton, and students who don't play any sport. The main function calls these output functions after taking the necessary input.

Uploaded by

pallavi-vetal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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;
}
}

You might also like