Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a class template called Generic Vector. The class should have the following members: a) Private Data Member: vec (a vector of type parameter). b)
Create a class template called Generic Vector. The class should have the following members: a) Private Data Member: vec (a vector of type parameter). b) Public Member Functions: push: This public function should accept an argument and insert its value at the end of the vector. last. This function should accept no argument and return the value of the last element of the vector. Print. This function will print all the elements in vector. c) After you have created the class template, develop a test program (containing main()) that will do the following: i. declare an object of Generic Vector where the type parameter will be replaced by double. ii. enter at least 3 double values into the vec data member of object created in (i). iii. in use the last function to print the last element of the object's vec data member. iv. use. the print function to print all elements of the object's vec data member. use a stream manipulator to ensure that 2 digits are printed after decimal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started