SlideShare a Scribd company logo
1 of 3
Download to read offline
Could you implement this please. I was told to use pointers as the data Members. Thank you .
class Set
{
public:
Set();
Set(int n);
Set(Set &set);
int get_size() const;
bool contains(int n) const;
void expand_set();
void add(int n);
Set& operator=(Set &);
void out();
virtual ~Set();
private:
int* elements;
int *size;
};
Solution
Here is the code for you:
class Set
{
public:
Set()
{
size = 50;
elements = new int(size);
for(int i = 0; i < 50; i++)
set[i] = 0;
}
Set(int n)
{
size = n;
elements = new int(size);
for(int i = 0; i < size; i++)
set[i] = 0;
}
Set(Set &set)
{
set.size = size;
set.elements = new int(size);
for(int i = 0; i < size; i++)
set.elements[i] = elements[i];
}
int get_size() const
{
return size;
}
bool contains(int n) const
{
for(int i = 0; i < size; i++)
if(elements[i] == n)
return true;
return false;
}
void expand_set()
{
int *temp = new int(size * 2);
for(int i = 0; i < size; i++)
temp[i] = elements[i];
elements = temp;
}
void add(int n);
Set& operator=(Set &x)
{
size = x.size;
for(int i = 0; i < size; i++)
elements[i] = x.elements[i];
return x;
}
void out()
{
cout<<"The set is"<

More Related Content

Similar to Could you implement this please. I was told to use pointers as the d.pdf

Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfComplete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfaccess2future1
 
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdfarihantelehyb
 
program#include iostreamusing namespace std;void calculatio.pdf
program#include iostreamusing namespace std;void calculatio.pdfprogram#include iostreamusing namespace std;void calculatio.pdf
program#include iostreamusing namespace std;void calculatio.pdfinfo382133
 
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdf
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdfSolve the coding errors for upvotemake test-statsg++ -g -std=c++.pdf
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdfsnewfashion
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxarjurakibulhasanrrr7
 
computer Science project.pdf
 computer Science project.pdf computer Science project.pdf
computer Science project.pdfManasviGupta32
 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1sotlsoc
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxAbhishek Tirkey
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxGauravPandey43518
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notessuman khadka
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfacesmelpon
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsVishvjeet Yadav
 
Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2Mouna Guru
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdfaravlitraders2012
 

Similar to Could you implement this please. I was told to use pointers as the d.pdf (20)

Lab 13
Lab 13Lab 13
Lab 13
 
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdfComplete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdf
 
C arrays
C arraysC arrays
C arrays
 
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
 
program#include iostreamusing namespace std;void calculatio.pdf
program#include iostreamusing namespace std;void calculatio.pdfprogram#include iostreamusing namespace std;void calculatio.pdf
program#include iostreamusing namespace std;void calculatio.pdf
 
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdf
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdfSolve the coding errors for upvotemake test-statsg++ -g -std=c++.pdf
Solve the coding errors for upvotemake test-statsg++ -g -std=c++.pdf
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptx
 
computer Science project.pdf
 computer Science project.pdf computer Science project.pdf
computer Science project.pdf
 
Chapter 7.1
Chapter 7.1Chapter 7.1
Chapter 7.1
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notes
 
Compose Method
Compose MethodCompose Method
Compose Method
 
Compose Method
Compose MethodCompose Method
Compose Method
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfaces
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
Op ps
Op psOp ps
Op ps
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
 
Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdf
 

More from fms12345

Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdf
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdfExercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdf
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdffms12345
 
Describe the procedure you would use in the laboratory to determine .pdf
Describe the procedure you would use in the laboratory to determine .pdfDescribe the procedure you would use in the laboratory to determine .pdf
Describe the procedure you would use in the laboratory to determine .pdffms12345
 
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdf
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdfCHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdf
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdffms12345
 
A piece of malware is running on a Windows 7 machine via process inj.pdf
A piece of malware is running on a Windows 7 machine via process inj.pdfA piece of malware is running on a Windows 7 machine via process inj.pdf
A piece of malware is running on a Windows 7 machine via process inj.pdffms12345
 
Company names Aerial Drones Surveillance Inc. Your company descript.pdf
Company names Aerial Drones Surveillance Inc. Your company descript.pdfCompany names Aerial Drones Surveillance Inc. Your company descript.pdf
Company names Aerial Drones Surveillance Inc. Your company descript.pdffms12345
 
2. The Lorenz curve measures inequality in person income distribution.pdf
2. The Lorenz curve measures inequality in person income distribution.pdf2. The Lorenz curve measures inequality in person income distribution.pdf
2. The Lorenz curve measures inequality in person income distribution.pdffms12345
 
13 808 PM docs.google.com Covalent Bonding and lonic Bonding study.pdf
13 808 PM  docs.google.com Covalent Bonding and lonic Bonding study.pdf13 808 PM  docs.google.com Covalent Bonding and lonic Bonding study.pdf
13 808 PM docs.google.com Covalent Bonding and lonic Bonding study.pdffms12345
 
1.The shrimping industry needs female shrimp for production purposes.pdf
1.The shrimping industry needs female shrimp for production purposes.pdf1.The shrimping industry needs female shrimp for production purposes.pdf
1.The shrimping industry needs female shrimp for production purposes.pdffms12345
 
Who are the stakeholders in an income statement and whySolution.pdf
Who are the stakeholders in an income statement and whySolution.pdfWho are the stakeholders in an income statement and whySolution.pdf
Who are the stakeholders in an income statement and whySolution.pdffms12345
 
Which company maintains natural habitats while B allowing us to live .pdf
Which company maintains natural habitats while B allowing us to live .pdfWhich company maintains natural habitats while B allowing us to live .pdf
Which company maintains natural habitats while B allowing us to live .pdffms12345
 
When multiple strains of the same bacterial species are sequenced, w.pdf
When multiple strains of the same bacterial species are sequenced, w.pdfWhen multiple strains of the same bacterial species are sequenced, w.pdf
When multiple strains of the same bacterial species are sequenced, w.pdffms12345
 
What specialized cells line the inner cavity and move fluids through.pdf
What specialized cells line the inner cavity and move fluids through.pdfWhat specialized cells line the inner cavity and move fluids through.pdf
What specialized cells line the inner cavity and move fluids through.pdffms12345
 
What does the metaphor meaning for the Iron curtainSolutionIr.pdf
What does the metaphor meaning for the Iron curtainSolutionIr.pdfWhat does the metaphor meaning for the Iron curtainSolutionIr.pdf
What does the metaphor meaning for the Iron curtainSolutionIr.pdffms12345
 
What are the major developmental milestones between infancy and todd.pdf
What are the major developmental milestones between infancy and todd.pdfWhat are the major developmental milestones between infancy and todd.pdf
What are the major developmental milestones between infancy and todd.pdffms12345
 
Using the Web or another research tool, search for alternative means.pdf
Using the Web or another research tool, search for alternative means.pdfUsing the Web or another research tool, search for alternative means.pdf
Using the Web or another research tool, search for alternative means.pdffms12345
 
Using Array Approach, Linked List approach, and Delete Byte Approach.pdf
Using Array Approach, Linked List approach, and Delete Byte Approach.pdfUsing Array Approach, Linked List approach, and Delete Byte Approach.pdf
Using Array Approach, Linked List approach, and Delete Byte Approach.pdffms12345
 
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdf
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdfTV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdf
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdffms12345
 
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdf
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdfTim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdf
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdffms12345
 
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdf
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdfThe Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdf
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdffms12345
 
1. CDOs are normally divided into tranches. Holders of this tranche .pdf
1. CDOs are normally divided into tranches. Holders of this tranche .pdf1. CDOs are normally divided into tranches. Holders of this tranche .pdf
1. CDOs are normally divided into tranches. Holders of this tranche .pdffms12345
 

More from fms12345 (20)

Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdf
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdfExercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdf
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdf
 
Describe the procedure you would use in the laboratory to determine .pdf
Describe the procedure you would use in the laboratory to determine .pdfDescribe the procedure you would use in the laboratory to determine .pdf
Describe the procedure you would use in the laboratory to determine .pdf
 
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdf
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdfCHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdf
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdf
 
A piece of malware is running on a Windows 7 machine via process inj.pdf
A piece of malware is running on a Windows 7 machine via process inj.pdfA piece of malware is running on a Windows 7 machine via process inj.pdf
A piece of malware is running on a Windows 7 machine via process inj.pdf
 
Company names Aerial Drones Surveillance Inc. Your company descript.pdf
Company names Aerial Drones Surveillance Inc. Your company descript.pdfCompany names Aerial Drones Surveillance Inc. Your company descript.pdf
Company names Aerial Drones Surveillance Inc. Your company descript.pdf
 
2. The Lorenz curve measures inequality in person income distribution.pdf
2. The Lorenz curve measures inequality in person income distribution.pdf2. The Lorenz curve measures inequality in person income distribution.pdf
2. The Lorenz curve measures inequality in person income distribution.pdf
 
13 808 PM docs.google.com Covalent Bonding and lonic Bonding study.pdf
13 808 PM  docs.google.com Covalent Bonding and lonic Bonding study.pdf13 808 PM  docs.google.com Covalent Bonding and lonic Bonding study.pdf
13 808 PM docs.google.com Covalent Bonding and lonic Bonding study.pdf
 
1.The shrimping industry needs female shrimp for production purposes.pdf
1.The shrimping industry needs female shrimp for production purposes.pdf1.The shrimping industry needs female shrimp for production purposes.pdf
1.The shrimping industry needs female shrimp for production purposes.pdf
 
Who are the stakeholders in an income statement and whySolution.pdf
Who are the stakeholders in an income statement and whySolution.pdfWho are the stakeholders in an income statement and whySolution.pdf
Who are the stakeholders in an income statement and whySolution.pdf
 
Which company maintains natural habitats while B allowing us to live .pdf
Which company maintains natural habitats while B allowing us to live .pdfWhich company maintains natural habitats while B allowing us to live .pdf
Which company maintains natural habitats while B allowing us to live .pdf
 
When multiple strains of the same bacterial species are sequenced, w.pdf
When multiple strains of the same bacterial species are sequenced, w.pdfWhen multiple strains of the same bacterial species are sequenced, w.pdf
When multiple strains of the same bacterial species are sequenced, w.pdf
 
What specialized cells line the inner cavity and move fluids through.pdf
What specialized cells line the inner cavity and move fluids through.pdfWhat specialized cells line the inner cavity and move fluids through.pdf
What specialized cells line the inner cavity and move fluids through.pdf
 
What does the metaphor meaning for the Iron curtainSolutionIr.pdf
What does the metaphor meaning for the Iron curtainSolutionIr.pdfWhat does the metaphor meaning for the Iron curtainSolutionIr.pdf
What does the metaphor meaning for the Iron curtainSolutionIr.pdf
 
What are the major developmental milestones between infancy and todd.pdf
What are the major developmental milestones between infancy and todd.pdfWhat are the major developmental milestones between infancy and todd.pdf
What are the major developmental milestones between infancy and todd.pdf
 
Using the Web or another research tool, search for alternative means.pdf
Using the Web or another research tool, search for alternative means.pdfUsing the Web or another research tool, search for alternative means.pdf
Using the Web or another research tool, search for alternative means.pdf
 
Using Array Approach, Linked List approach, and Delete Byte Approach.pdf
Using Array Approach, Linked List approach, and Delete Byte Approach.pdfUsing Array Approach, Linked List approach, and Delete Byte Approach.pdf
Using Array Approach, Linked List approach, and Delete Byte Approach.pdf
 
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdf
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdfTV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdf
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdf
 
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdf
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdfTim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdf
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdf
 
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdf
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdfThe Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdf
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdf
 
1. CDOs are normally divided into tranches. Holders of this tranche .pdf
1. CDOs are normally divided into tranches. Holders of this tranche .pdf1. CDOs are normally divided into tranches. Holders of this tranche .pdf
1. CDOs are normally divided into tranches. Holders of this tranche .pdf
 

Recently uploaded

Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 

Recently uploaded (20)

Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Could you implement this please. I was told to use pointers as the d.pdf

  • 1. Could you implement this please. I was told to use pointers as the data Members. Thank you . class Set { public: Set(); Set(int n); Set(Set &set); int get_size() const; bool contains(int n) const; void expand_set(); void add(int n); Set& operator=(Set &); void out(); virtual ~Set(); private: int* elements; int *size; }; Solution Here is the code for you: class Set { public: Set() { size = 50; elements = new int(size); for(int i = 0; i < 50; i++) set[i] = 0; } Set(int n)
  • 2. { size = n; elements = new int(size); for(int i = 0; i < size; i++) set[i] = 0; } Set(Set &set) { set.size = size; set.elements = new int(size); for(int i = 0; i < size; i++) set.elements[i] = elements[i]; } int get_size() const { return size; } bool contains(int n) const { for(int i = 0; i < size; i++) if(elements[i] == n) return true; return false; } void expand_set() { int *temp = new int(size * 2); for(int i = 0; i < size; i++) temp[i] = elements[i]; elements = temp; } void add(int n); Set& operator=(Set &x) { size = x.size; for(int i = 0; i < size; i++)
  • 3. elements[i] = x.elements[i]; return x; } void out() { cout<<"The set is"<