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 Posted / 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 View All Answers
What is the full form of oops?
How does polymorphism work?
What do you mean by abstraction?
Can abstract class have normal methods?
What is a superclass in oop?
when to use 'mutable' keyword and when to use 'const cast' in c++
What are the benefits of polymorphism?
Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation
What is multilevel inheritance in oop?
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
write a program to find 2^n+1 ?
Write a program to sort the number with different sorts in one program ??
Get me a number puzzle game-program
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
what are the ways in which a constructors can be called?