Code:
#include<iostream>
using namespace std;
main()
{
int A[5];
int B[5];
cout<<"Enter First 5 elements: "<<endl;
for(int i=0; i<5; i++){
cin>>A[i];
}
cout<<"Enter Second 5 elements: "<<endl;
for(int i=0; i<5; i++){
cin>>B[i];
}
cout<<"Union of Set A and Set B: "<<endl;
cout<<"\nIntersection of Set A and Set B: "<<endl;
for(int i=0; i<5; i++){
for(int t=0; t<5; t++){
if(A[i] == B[t]){
cout<<A[i]<<" ";
}
}
}
cout<<endl;
system("pause");
return 0;
}
hey can someone help me[need help!!!].....on how to solve the union of set a and set b like in ascending order....
Output:
like in
Set A i enter:
1 2 3 4 5
Set B i enter:
1 2 3 5 6
Union of Set A and B
1 2 3 4 5 6
Intersection of Set A and B
1 2 3 4 5
plz need help!.....