i have two sets which i assigned them in an array
i want to have the union of two sets in a new array
can any one help
Printable View
i have two sets which i assigned them in an array
i want to have the union of two sets in a new array
can any one help
Sure, what's the actual problem - show some code.
nowCode:int i;
int a[10],b[10],c[10];
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
scanf("%d",&b[i]);
suppouse i entered 1,2,3 in a[0],a[1],a[2]
and 4,5,6 in b[0],b[1],b[2] respectively
i want 1,2,3,4,5,6 to be copied to c[0],c[1],c[2],c[3],c[4],c[5]
i think i am clear with my question
Have you written a 'isMemberOfSet' function?
If you have one of these, then writing union and intersection is just a matter of repeatedly calling that function in a loop and deciding what to do with the true/false answer.