Implement the class named CVector see above. The class should contain: [ - ] Two public member
Fantastic news! We've Found the answer you've been seeking!
Question:
Implement the class named CVector see above. The class should contain:
Two public member variables of type int named x and y as given.
A constructor function with default arguments
Overload the the addition operator as a member function such that it adds
each element of the given vector to the corresponding element of the defined vector.
This operation is identical to simple vectorvector addition:
u vux vx uy vy
Overload the the subtraction operator as a nonmember function such that
it subtracts each element of the other vector from the corresponding element of the
given vector::
u vux vx uy vy
Overload the the multiplication operator as a member function such that it
multiplies each element of the given vector by the corresponding element of another
given vector:
u times vux vx uy vy
Overload the the division operator as a nonmember function such that it
divides each element of this vector by the corresponding element of the other vector
note that elementwise this will be regular integer division that results in integer:
uvuxvx uyvy
See the code above for the examples of vector addition and subtraction, and
also provide examples for the multiplication and the division.
Related Book For
Data Structures And Algorithms In C++
ISBN: 9780470383278
2nd Edition
Authors: Michael T. Goodrich, Roberto Tamassia, David M. Mount
Posted Date: