Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void aff(int t[],int n,char x)
- {
- printf("This is your array %c:\n______________________________\n{",x);
- for (int a=0;a<n;a++)
- {
- if(a<n-1)
- printf("%d,\t",t[a]);
- else
- printf("%d",t[a]);
- }
- printf("}\n______________________________\n\n\n");
- }
- void remp(int *t,int n,char ch[],char c)
- {
- printf("aight fill up the %s list:\n",ch);
- for (int a=0; a<n;a++)
- {
- printf("%c[%d]: ",c,a);
- scanf("%d",t+a);
- }
- }
- int symetricDifference(int A[],int B[],int *C,int n,int m,int c)
- {
- int b;
- ///method one
- for (int a=0;a<n;a++)
- {
- for ( b=0;b<m;b++)
- {
- if (A[a]==B[b])
- break;
- }
- if (b<m)
- continue;
- *(C+c) = A[a];
- c++;
- }
- return c;
- }
- int main()
- {
- int n,m;
- printf("gimme N and M boi:\n");
- scanf("%d%d",&n,&m);
- int l=m+n;
- int A[n],B[m],C[l];
- remp(A,n,"first",'A');
- remp(B,m,"second",'B');
- //this is decoration a7guerha
- system("cls");
- system("color 3");
- aff(A,n,'A');
- aff(B,m,'B');
- //putting the first half in welli heya A-B
- l=symetricDifference(A,B,C,n,m,0);
- //adding the second half welli heya B-A
- l=symetricDifference(B,A,C,m,n,l);
- aff(C,l,'C');
- }
Add Comment
Please, Sign In to add comment