Question { 2878 }
me get an assignent n its question is this 1.creat a set as
in math i.ea={1,2} 2.insert element in it3. delete element
don,t repeat any element 4.union 5. intersection of two sets
plz help me i always pray for u n send me at
ayeshawzd@hotmail.com f u have c++ how to program 5th
addition then it is the 10.9 question in 10th chapter
exercise
Answer
#include
#include
#include
#include
#include
class set
{
private:
int array1[5],array2[5],num1,num2,array3[11];
public:
set();
void manu();
void creatset();
void insert();
void deleteword();
void showelement();
void unionset();
void intersection();
void isequal();
};
set::set(){
for(int i=0;i<=10;i++){
array1[i]=0;
}
}
void set::manu(){
cout<<"---------------------------WELCOME TO INTEGER
SETCLASS--------------------------"<
cout<<"\t\t\t1.creat set"<
cout<<"\t\t\t2.insert element"<
cout<<"\t\t\t3.delete element"<
cout<<"\t\t\t4.show element"<
cout<<"\t\t\t5.union"<
cout<<"\t\t\t6.intersection"<
cout<<"\t\t\t7.is equql"<
cout<<"\t\t\t8.exit"<
}
void set::creatset(){
cout<<"enter 5 numbers set A"<
cin>>num1;
cout<<"SetA={";
for(int i=0;i<5;i++){
array1[i]=getche();
cout<<",";
}
cout<<"}" <
cout<<"enter 5 number of integers set B"<
cin>>num2;
cout<<"setB={";
for(int j=0;j<5;j++) {
array2[j]=getche();
cout<<",";
}
cout<<"}"<
} //end set input
void set::unionset(){
for(int i=0;i<5;i++){
array3[i]=array1[i];
}
for(int j=0;j<5;j++){
array3[j+5]=array2[j];
}
for(int k=0;k<=11;k++)
{
cout<
}
}
void main(){
clrscr();
set p;
char choice;
while (1){
p.manu();
cout << "Enter the option=";
cin >> choice;
switch (choice){
case '1':
p.creatset();
break;
/*
case 'S':
p.carParked();
break;*/
case '5':
p.unionset();
break;
case'8':
exit(0);
break;
default:
break;
}
}
getch();
}
kisi ny nhe help kii mai ny khud hi kar dia