Question: I NEED HELP TO WRITE MyVector.h and MyVector.cpp USING THE INSTRUCTION BELOW For this assignment you will add a copy constructor and the following overloaded

I NEED HELP TO WRITE MyVector.h and MyVector.cpp USING THE INSTRUCTION BELOW

For this assignment you will add a copy constructor and the following overloaded operators to your MyVector class:

Here's a description of how each operator should behave:

operator returns true if the length of the left-hand side MyVector is less than the length of the right-hand side MyVector, false otherwise.

operator== : returns true if both MyVectors contain the exact same values, false otherwise.

operator= : overwrites the contents of the left-hand side MyVector with the contents of the right-hand side MyVector.

operator+ : returns a MyVector object that contains an element-by-element sum of the two operators. Consider the following snippet:

MyVector m, n;

cout

If m contains the values 1, 2, 3 and n contains the values 4, 5, then the output would be:

[5, 7, 3].

operator sends a string representation of the MyVector object to the output stream. For example, if the MyVector contains 8 6 7, then operator

MyVector m; ... cout

You would see

[8, 6, 7]

on the screen.

operator++: post-fix version. increments each element by 1. Returns a MyVector object.

operator[]: allows for retrieving and changing elements of the MyVector.

AND

GIVEN THE main.cpp TO TEST THE PROGRAM.

I NEED HELP TO WRITE MyVector.h and MyVector.cpp USING THE INSTRUCTION BELOW

#include "MyVectorh" #include iostream using namespace std; #include.c stdlib int main() MyVector m for(int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!