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



me get an assignent n its question is this 1.creat a set as in math i.ea={1,2} 2.insert element in..

Answer / ayesha

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<iostream.h>
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--------------------------"<<endl;
cout<<"\t\t\t1.creat set"<<endl;
cout<<"\t\t\t2.insert element"<<endl;
cout<<"\t\t\t3.delete element"<<endl;
cout<<"\t\t\t4.show element"<<endl;
cout<<"\t\t\t5.union"<<endl;
cout<<"\t\t\t6.intersection"<<endl;
cout<<"\t\t\t7.is equql"<<endl;
cout<<"\t\t\t8.exit"<<endl;
}
void set::creatset(){
cout<<"enter 5 numbers set A"<<endl;
cin>>num1;
cout<<"SetA={";
for(int i=0;i<5;i++){

array1[i]=getche();

cout<<",";
}
cout<<"}" <<endl;

cout<<"enter 5 number of integers set B"<<endl;
cin>>num2;
cout<<"setB={";
for(int j=0;j<5;j++) {
array2[j]=getche();
cout<<",";
}
cout<<"}"<<endl;
} //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<<array3[k];
}

}
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

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

what is the abstract class,interface ,its difference with a programatic eg.? hi,recently i went for an interview they ask me what is abstract class ,interface and its difference I said abstract class contain abstact method ,abstract method is a method with no body.Abstract class cannot be instantiated.Abstract class is a base class it required derived class for the implementation of method. Interface is a syntactical contract that all derived class should follow it define properties ,method,events which are known as member of interface. Then They asked me what is the difference between them. I said abstract class interface 1.abstact class can implement method 1.interface cant 2.abstact class can contain constructor, 2.interface cant destructor 3.abstract class cannot support multiple 3.interface support inheritance etc Then they said some different answer I said dont no. Then they ask me when i should make abstract class for an project and when i should make interface. I said if suppose there is two class which must be having method with different logic then we sholud make abstract class. and if suppose we have two class having method .with different logic then we can make interface . Am i correct with my explaination.if not correct me .please provide me that when should we create abstract class and interface and what is difference .please help me

1 Answers  


How to improve object oriented design skills?

0 Answers  


why c++ is a highlevel language

3 Answers   Satyam, Tech Mahindra,


Can anyone please explain runtime polymorphism with a real time example??at what ciscumstances we go for it??

1 Answers  


What is differance between Abstract and Interface

3 Answers  






What are functions in oop?

0 Answers  


What do you mean by inheritance?

0 Answers   IBS,


I am developing a payroll system mini project.I used file concept in program for reading and writing.When the program is reloading into the memory that is if i execute next time the file was cleaned and adding data from the starting this is my problem.I want to strore the previous data and if i want to add any record that should be next of previous data.Please help me.

0 Answers  


what is meant by files?

4 Answers   Infosys,


WAP to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

1 Answers  


What are virtual classes?

0 Answers  


1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)

1 Answers   Nagarro,


Categories