techking_dinesh
Digit Squad Member
Hello.
I need a little help with c.
I have to code a programme with following features.
Enter 2 Sets and display them on Screen in sorted order with no elements repeated ( Using array )
Then Using Switch case to perform the following operations
1. Union
2. Intersection
3. difference
4. Symmetric Difference
i tried google and got some codes but those are of high level for me
plz help
I hav managed d most basic part of d code as follows:
Waiting for solution
I need a little help with c.
I have to code a programme with following features.
Enter 2 Sets and display them on Screen in sorted order with no elements repeated ( Using array )
Then Using Switch case to perform the following operations
1. Union
2. Intersection
3. difference
4. Symmetric Difference
i tried google and got some codes but those are of high level for me
plz help
I hav managed d most basic part of d code as follows:
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int a[50],b[50],c[50],size1,size2,i=0,j=0,z;
clrscr();
printf("\n Set Operations Menu");
printf("\n 1. Union of Set");
printf("\n 2. Intersection of Set");
printf("\n 3. Difference of Set");
printf("\n 4. Symmetric Difference of Set");
printf("\n 5. Exit\n\n\n");
// switch(z)
printf("\n Enter the Size of Set A: ");
scanf("%d",&size1);
printf("\n Enter %d elements for set A: ",size1);
for(i=0;i<size1;i++)
{
scanf("%d",&a[i]);
}
printf("\n Enter the Size of Set B: ");
scanf("%d",&size2);
printf("\n Enter %d elements for set B: ",size2);
for(j=0;j<size2;j++)
{
scanf("%d",&b[j]);
}
printf("\n A is ");
printf("A={");
for(i=0;i<size1;i++)
{
printf("%d,",a[i]);
}
printf("\b}");
printf("\n B is ");
printf("B={");
for(j=0;j<size2;j++)
{
printf("%d,",b[j]);
}
printf("\b}");
getch();
}
Waiting for solution