Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Create a class template called GenericVector. The class should have the following members: (Reference: Fig 18.2 and Fig 18.3) a) Private Data Member:

In C++

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Create a class template called GenericVector. The class should have the following members: (Reference: Fig 18.2 and Fig 18.3) 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. (Hint: can use vector's push_back method) last: This function should accept no argument and return the value of the last element of the vector. print: This function will print al the elements in vector c)After you have created the class template, develop a test program (containing main0) that will do the following: i. declare an object of Generic lector 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. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago