Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[1000],b[1000],c[2000],n,m,i,k,j,ok;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- cin>>a[i];
- cout<<"m=";cin>>m;
- for (i=0;i<m;i++)
- cin>>b[i];
- for (i=0;i<n;i++)
- c[i]=a[i];
- k=n;
- for (j=0;j<m;j++)
- {
- ok=1;
- for (i=0;i<n;i++)
- if (b[j]==a[i])
- ok=0;
- if (ok)
- {
- c[k]=b[j];
- k++;
- }
- }
- cout<<"A reunit cu B:"<<endl;
- for (i=0;i<k;i++)
- cout<<c[i]<<' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement