Object Oriented Programming and Design with C++ Dr. Aaron Naiman
Course #15001301 <naiman@math.jct.ac.il>
Spring, 2006 Office hours: Monday, 13:30-14:30

Exercise Set #5


Add to your class the following capabilities

  1. operator<<(), operator>>()
  2. operator!=(), operator+(), operator-(), operator+=(), operator-=(), operator<(), operator>(), operator<=(), operator>=(), operator*(), operator/()
Think carefully as to what the argument(s) should be, which (including earlier defined operators as well) should be members, and which global (and perhaps friends). Also, consider what should be inline, and how you can have some functions use the results of calculations of other functions which perform similar tasks (but perhaps differ in member/global, and/or take different argument lists). It is often easier to have the work done in one of the functions, and have the remaining functions call the former.

Until further notice, there is no need to include the pointer field.

Have your main() supply the user with a menu (iterating until s/he decides to quit), for at least the following

  1. allocating an array of objects
  2. saving/restoring the array of objects to/from a file
  3. printing/changing individual objects of the array
  4. performing simple calculations on the objects of the array