Advertisement
iKyriaki

vector operator+=

Apr 19th, 2014
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. vector &vector::operator+=(const vector &w)
  2. {
  3.     // To Do
  4.     //
  5.     // Add the vector "w" to this vector.  Note that we have to return this vector once we
  6.     // are done to support c++ statement such as v0 = v1 = v2.
  7.     int i = 0;
  8.     while (this) {
  9.         v[i] += w.v[i];
  10.         i++;
  11.     }
  12.     return *this;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement