SlideShare a Scribd company logo
1 of 6
Download to read offline
any idea?
#include
using std::cout; using std::endl;
using std::ostream; using std::cin; using std::boolalpha;
#include
using std::copy; using std::sort;
#include
using std::swap;
#include
using std::string;
#include
using std::vector;
#include
using std::distance; using std::istream_iterator;
using std::back_inserter;
#include
using std::ostringstream;
// ADD MORE INCLUDES if you need them to the above
template
struct SetElement{
public:
T element;
int cnt;
SetElement()=default;
SetElement(T val);
};
// FIX BELOW for SetElement!!!
// The T val constructor and operator<< below here for SetElement
template
SetElement::SetElement(T val){
cnt = 1;
element = val;
}
template
ostream &operator<<(ostream os, const SetElement& p){
os<
class MSet{
private:
SetElement* ary_;
size_t size_;
size_t capacity_;
void grow();
public:
MSet(size_t s=2);
MSet(T val);
MSet(vector&);
MSet(MSet&);
MSet operator=(MSet);
~MSet();
size_t size();
size_t capacity();
SetElement* find(T);
void insert(T);
size_t count(T val);
bool erase(T);
friend ostream& operator<<(ostream& out, MSet& m){
// FIX THIS RIGHT HERE. ENTER YOUR CODE HERE
out<<"test";
return out;
};
};
// MANY THINGS BELOW HERE FOR MSet
template
MSet::MSet(size_t s){
ary_ = new T[s]();
}
/*
template
size_t MSet::size_(){
cout <<"test"<< endl;
return size_t;
}
*/
// DO NOT CHANGE ANYTHING BELOW. TESTING!
int main(){
int test;
long l1, l2, l3;
cin >> test;
cout << boolalpha;
switch (test){
// basic constructors, .size() and .capacity()
case 1 : {
MSet m_l;
/*
cout << m_l.size() <<":"<< m_l.capacity()<> l1;
MSet m_l_oneval(l1);
cout << m_l_oneval.size() <<":"<< m_l_oneval.capacity()<
Solution
your mistack is:
ary_ = new SetElement[s]; is correct.
not ary_ = new T[s]();
Program:
#include
using std::cout; using std::endl;
using std::ostream; using std::cin; using std::boolalpha;
#include
using std::copy; using std::sort;
#include
using std::swap;
#include
using std::string;
#include
using std::vector;
#include
using std::distance; using std::istream_iterator;
using std::back_inserter;
#include
using std::ostringstream;
// ADD MORE INCLUDES if you need them to the above
template
struct SetElement{
public:
T element;
int cnt;
SetElement()=default;
SetElement(T val);
};
// FIX BELOW for SetElement!!!
// The T val constructor and operator<< below here for SetElement
template
SetElement::SetElement(T val){
cnt = 1;
element = val;
}
template
ostream &operator<<(ostream os, const SetElement& p){
os<
class MSet{
private:
SetElement* ary_;
size_t size_;
size_t capacity_;
void grow();
public:
MSet(size_t s=2);
MSet(T val);
MSet(vector&);
MSet(MSet&);
MSet operator=(MSet);
~MSet();
size_t size();
size_t capacity();
SetElement* find(T);
void insert(T);
size_t count(T val);
bool erase(T);
friend ostream& operator<<(ostream& out, MSet& m){
// FIX THIS RIGHT HERE. ENTER YOUR CODE HERE
out<<"test";
return out;
};
};
// MANY THINGS BELOW HERE FOR MSet
template
MSet::MSet(size_t s){
ary_ = new SetElement[s];
}
/*
template
size_t MSet::size_(){
cout <<"test"<< endl;
return size_t;
}
*/
// DO NOT CHANGE ANYTHING BELOW. TESTING!
int main(){
int test;
long l1, l2, l3;
cin >> test;
cout << boolalpha;
switch (test){
// basic constructors, .size() and .capacity()
case 1 : {
MSet m_l;
/*
cout << m_l.size() <<":"<< m_l.capacity()<> l1;
MSet m_l_oneval(l1);
cout << m_l_oneval.size() <<":"<< m_l_oneval.capacity()<

More Related Content

Similar to any idea#includeiostream using stdcout; using stdendl; .pdf

Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdfNeed help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
actexerode
 
Can you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdfCan you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdf
aksachdevahosymills
 
Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
Reggie Meisler
 
I need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docxI need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docx
hendriciraida
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
pnaran46
 
Please solve the TODO parts include LinkedListcpph tem.pdf
Please solve the TODO parts  include LinkedListcpph tem.pdfPlease solve the TODO parts  include LinkedListcpph tem.pdf
Please solve the TODO parts include LinkedListcpph tem.pdf
aggarwalopticalsco
 
#include iostream #include deque #include stdio.h   scan.pdf
#include iostream #include deque #include stdio.h   scan.pdf#include iostream #include deque #include stdio.h   scan.pdf
#include iostream #include deque #include stdio.h   scan.pdf
anandmobile
 

Similar to any idea#includeiostream using stdcout; using stdendl; .pdf (20)

Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdfNeed help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdfC++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
 
C intro
C introC intro
C intro
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Can you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdfCan you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdf
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Changing Template Engine
Changing Template EngineChanging Template Engine
Changing Template Engine
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
 
I need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docxI need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docx
 
C programm.pptx
C programm.pptxC programm.pptx
C programm.pptx
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
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
 
Toonz code leaves much to be desired
Toonz code leaves much to be desiredToonz code leaves much to be desired
Toonz code leaves much to be desired
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
 
Please solve the TODO parts include LinkedListcpph tem.pdf
Please solve the TODO parts  include LinkedListcpph tem.pdfPlease solve the TODO parts  include LinkedListcpph tem.pdf
Please solve the TODO parts include LinkedListcpph tem.pdf
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
#include iostream #include deque #include stdio.h   scan.pdf
#include iostream #include deque #include stdio.h   scan.pdf#include iostream #include deque #include stdio.h   scan.pdf
#include iostream #include deque #include stdio.h   scan.pdf
 
Object Oriented Programming using C++ - Part 5
Object Oriented Programming using C++ - Part 5Object Oriented Programming using C++ - Part 5
Object Oriented Programming using C++ - Part 5
 

More from petercoiffeur18

Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
petercoiffeur18
 
In what ways do humans effect the environment Explain in 200 words.pdf
In what ways do humans effect the environment Explain in 200 words.pdfIn what ways do humans effect the environment Explain in 200 words.pdf
In what ways do humans effect the environment Explain in 200 words.pdf
petercoiffeur18
 
i need a taking turn method for a player vs computer battleship game.pdf
i need a taking turn method for a player vs computer battleship game.pdfi need a taking turn method for a player vs computer battleship game.pdf
i need a taking turn method for a player vs computer battleship game.pdf
petercoiffeur18
 
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdfI am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
petercoiffeur18
 
how internal resources and capabilities can be a source of sustainab.pdf
how internal resources and capabilities can be a source of sustainab.pdfhow internal resources and capabilities can be a source of sustainab.pdf
how internal resources and capabilities can be a source of sustainab.pdf
petercoiffeur18
 
Exercise 5.6.28. For each of the following descriptions of a function.pdf
Exercise 5.6.28. For each of the following descriptions of a function.pdfExercise 5.6.28. For each of the following descriptions of a function.pdf
Exercise 5.6.28. For each of the following descriptions of a function.pdf
petercoiffeur18
 
Discuss concepts associated with mercantilism demonstrating key poli.pdf
Discuss concepts associated with mercantilism demonstrating key poli.pdfDiscuss concepts associated with mercantilism demonstrating key poli.pdf
Discuss concepts associated with mercantilism demonstrating key poli.pdf
petercoiffeur18
 
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdfa) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
petercoiffeur18
 
21) What are the fundamental particles of lepton and quarks How man.pdf
21) What are the fundamental particles of lepton and quarks How man.pdf21) What are the fundamental particles of lepton and quarks How man.pdf
21) What are the fundamental particles of lepton and quarks How man.pdf
petercoiffeur18
 
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdf
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdfCase 1-A Transition to SupervisorTristan came in on the ground fl.pdf
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdf
petercoiffeur18
 
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdfx , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
petercoiffeur18
 
What relationship is there between gobalization and development.pdf
What relationship is there between gobalization and development.pdfWhat relationship is there between gobalization and development.pdf
What relationship is there between gobalization and development.pdf
petercoiffeur18
 

More from petercoiffeur18 (20)

John, a sociologist, will be focusing on how larger societal institu.pdf
John, a sociologist, will be focusing on how larger societal institu.pdfJohn, a sociologist, will be focusing on how larger societal institu.pdf
John, a sociologist, will be focusing on how larger societal institu.pdf
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
 
In what ways do humans effect the environment Explain in 200 words.pdf
In what ways do humans effect the environment Explain in 200 words.pdfIn what ways do humans effect the environment Explain in 200 words.pdf
In what ways do humans effect the environment Explain in 200 words.pdf
 
i need a taking turn method for a player vs computer battleship game.pdf
i need a taking turn method for a player vs computer battleship game.pdfi need a taking turn method for a player vs computer battleship game.pdf
i need a taking turn method for a player vs computer battleship game.pdf
 
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdfI am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
 
how internal resources and capabilities can be a source of sustainab.pdf
how internal resources and capabilities can be a source of sustainab.pdfhow internal resources and capabilities can be a source of sustainab.pdf
how internal resources and capabilities can be a source of sustainab.pdf
 
For an organism that is growing using glucose as the electron donor, .pdf
For an organism that is growing using glucose as the electron donor, .pdfFor an organism that is growing using glucose as the electron donor, .pdf
For an organism that is growing using glucose as the electron donor, .pdf
 
Exercise 5.6.28. For each of the following descriptions of a function.pdf
Exercise 5.6.28. For each of the following descriptions of a function.pdfExercise 5.6.28. For each of the following descriptions of a function.pdf
Exercise 5.6.28. For each of the following descriptions of a function.pdf
 
Discuss concepts associated with mercantilism demonstrating key poli.pdf
Discuss concepts associated with mercantilism demonstrating key poli.pdfDiscuss concepts associated with mercantilism demonstrating key poli.pdf
Discuss concepts associated with mercantilism demonstrating key poli.pdf
 
C++ Caesar Cipher project. Write your codes for the following functi.pdf
C++ Caesar Cipher project. Write your codes for the following functi.pdfC++ Caesar Cipher project. Write your codes for the following functi.pdf
C++ Caesar Cipher project. Write your codes for the following functi.pdf
 
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdfa) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
a) Use Newton’s Polynomials for Evenly Spaced data to derive the O(h.pdf
 
A radio station has a power output of 200 watts. What is the intensit.pdf
A radio station has a power output of 200 watts. What is the intensit.pdfA radio station has a power output of 200 watts. What is the intensit.pdf
A radio station has a power output of 200 watts. What is the intensit.pdf
 
21) What are the fundamental particles of lepton and quarks How man.pdf
21) What are the fundamental particles of lepton and quarks How man.pdf21) What are the fundamental particles of lepton and quarks How man.pdf
21) What are the fundamental particles of lepton and quarks How man.pdf
 
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdf
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdfCase 1-A Transition to SupervisorTristan came in on the ground fl.pdf
Case 1-A Transition to SupervisorTristan came in on the ground fl.pdf
 
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdfx , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
x , y Midterm Exsm-201840x Exam C httpsbb-montgomerycollege.blac.pdf
 
Why would a cell want to express genes in an operon Why notSol.pdf
Why would a cell want to express genes in an operon Why notSol.pdfWhy would a cell want to express genes in an operon Why notSol.pdf
Why would a cell want to express genes in an operon Why notSol.pdf
 
When discussing the epidemiology of virus infections, the CDC often .pdf
When discussing the epidemiology of virus infections, the CDC often .pdfWhen discussing the epidemiology of virus infections, the CDC often .pdf
When discussing the epidemiology of virus infections, the CDC often .pdf
 
What relationship is there between gobalization and development.pdf
What relationship is there between gobalization and development.pdfWhat relationship is there between gobalization and development.pdf
What relationship is there between gobalization and development.pdf
 
what is the number between 4.5 and 4.75 on the number linew.pdf
what is the number between 4.5 and 4.75 on the number linew.pdfwhat is the number between 4.5 and 4.75 on the number linew.pdf
what is the number between 4.5 and 4.75 on the number linew.pdf
 
What are the five main goals for Operations Managers, and how do the.pdf
What are the five main goals for Operations Managers, and how do the.pdfWhat are the five main goals for Operations Managers, and how do the.pdf
What are the five main goals for Operations Managers, and how do the.pdf
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Recently uploaded (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
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
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

any idea#includeiostream using stdcout; using stdendl; .pdf

  • 1. any idea? #include using std::cout; using std::endl; using std::ostream; using std::cin; using std::boolalpha; #include using std::copy; using std::sort; #include using std::swap; #include using std::string; #include using std::vector; #include using std::distance; using std::istream_iterator; using std::back_inserter; #include using std::ostringstream; // ADD MORE INCLUDES if you need them to the above template struct SetElement{ public: T element; int cnt; SetElement()=default; SetElement(T val); }; // FIX BELOW for SetElement!!! // The T val constructor and operator<< below here for SetElement template SetElement::SetElement(T val){ cnt = 1; element = val; } template ostream &operator<<(ostream os, const SetElement& p){
  • 2. os< class MSet{ private: SetElement* ary_; size_t size_; size_t capacity_; void grow(); public: MSet(size_t s=2); MSet(T val); MSet(vector&); MSet(MSet&); MSet operator=(MSet); ~MSet(); size_t size(); size_t capacity(); SetElement* find(T); void insert(T); size_t count(T val); bool erase(T); friend ostream& operator<<(ostream& out, MSet& m){ // FIX THIS RIGHT HERE. ENTER YOUR CODE HERE out<<"test"; return out; }; }; // MANY THINGS BELOW HERE FOR MSet template MSet::MSet(size_t s){ ary_ = new T[s](); } /* template
  • 3. size_t MSet::size_(){ cout <<"test"<< endl; return size_t; } */ // DO NOT CHANGE ANYTHING BELOW. TESTING! int main(){ int test; long l1, l2, l3; cin >> test; cout << boolalpha; switch (test){ // basic constructors, .size() and .capacity() case 1 : { MSet m_l; /* cout << m_l.size() <<":"<< m_l.capacity()<> l1; MSet m_l_oneval(l1); cout << m_l_oneval.size() <<":"<< m_l_oneval.capacity()< Solution your mistack is: ary_ = new SetElement[s]; is correct. not ary_ = new T[s](); Program: #include using std::cout; using std::endl; using std::ostream; using std::cin; using std::boolalpha; #include using std::copy; using std::sort; #include using std::swap; #include using std::string; #include using std::vector;
  • 4. #include using std::distance; using std::istream_iterator; using std::back_inserter; #include using std::ostringstream; // ADD MORE INCLUDES if you need them to the above template struct SetElement{ public: T element; int cnt; SetElement()=default; SetElement(T val); }; // FIX BELOW for SetElement!!! // The T val constructor and operator<< below here for SetElement template SetElement::SetElement(T val){ cnt = 1; element = val; } template ostream &operator<<(ostream os, const SetElement& p){ os< class MSet{ private: SetElement* ary_; size_t size_; size_t capacity_; void grow(); public: MSet(size_t s=2); MSet(T val); MSet(vector&); MSet(MSet&);
  • 5. MSet operator=(MSet); ~MSet(); size_t size(); size_t capacity(); SetElement* find(T); void insert(T); size_t count(T val); bool erase(T); friend ostream& operator<<(ostream& out, MSet& m){ // FIX THIS RIGHT HERE. ENTER YOUR CODE HERE out<<"test"; return out; }; }; // MANY THINGS BELOW HERE FOR MSet template MSet::MSet(size_t s){ ary_ = new SetElement[s]; } /* template size_t MSet::size_(){ cout <<"test"<< endl; return size_t; } */ // DO NOT CHANGE ANYTHING BELOW. TESTING! int main(){ int test; long l1, l2, l3; cin >> test; cout << boolalpha; switch (test){ // basic constructors, .size() and .capacity()
  • 6. case 1 : { MSet m_l; /* cout << m_l.size() <<":"<< m_l.capacity()<> l1; MSet m_l_oneval(l1); cout << m_l_oneval.size() <<":"<< m_l_oneval.capacity()<