Question
Create a template class named VectorController. This class has 1 data member a vector; The class should contain 3 constructors : a default constructor, a
Create a template class named VectorController. This class has 1 data member a vector; The class should contain 3 constructors: a default constructor, a constructor that accepts the size of the vector, and a constructor that accepts the size and default value for the vector. The class should also contain the following functions:
Function | Definition |
---|---|
setVector | sets the value of the vector data member |
getVector | returns the vector data memeber |
setIndexValue | sets the value of a specific index in the vector to the value provided by the user or pushes the value to end of the vector if the index does not exist. |
getSize | returns the size of the vector |
minimumValue | returns the smallest value in the vector |
maximumValue | returns the largest value in the vector |
Also overload the insertion stream operator (<<). This function should be templated so that you may use the same function with cout and fstream. The output should be as below.
You are provided a driver file to test your code. Do not change its contents.
Hints: (1) All methods are written inside the H file. Refer to the chapter for examples. (2) Use the resize function in the overloaded constructors. (3) The overloaded operator function implementation must be written inside the class definition. Other functions should be written just outside of the declaration in the H file.
Hello I was given the driver.cpp file:
#include
using namespace std;
int main() { VectorController
Now I need VectorController.h file and I need it in C++ thank you!
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