1.Write a stack class that has an STL vector as a data member. Your class should
ID: 3652440 • Letter: 1
Question
1.Write a stack class that has an STL vector as a data member. Your class should implement push, peek, and pop.2.Explain why you do not need to replace the default destructor, default assignment operator, or default copy constructor for the class in Problem 1.
3.Write an algorithm similar to the ones in STL which takes two iterators as parameters, and returns an iterator to the smallest item in the sequence.
4.Write a function object that returns true for positive ints and false for negative ints.
5.Write a short demo showing how your function object can be used with other parts of the STL to print all the negative elements of (1) an array of ints and (2) a vector of ints. The material in part D of the book may help with (1).
6.Modify the function object from part 4 to use templates. Include a constructor with an argument of the same type as the function argument. The function should return true if the function argument is larger then the constructor argument. Modify your program in Problem 5 to print (1) the elements larger than 'c' of an array of chars and (2) smaller than 50 of a deque of longs.
Explanation / Answer
Hey there, i understand that you want many questions to solve, but this site states in its rules that we cant post more than one question per post, but still the users here are kind enough to answer even if there are 2 or 3 questions in each post. All i would suggest you is to split up your post into 2 or 3 parts and repost it. Seeing that there are only 2 or 3 quesions to answers, ppl would be interested in solving rathar than so many questions for the same points. This will get you better and efficient answers as well.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.