Objectives:
Program with classes
Preparation:
Review sections 13.1-13.17 from Starting Out with C++ by Gattis.
Programming:
Create a class called Complex to model a complex number. Use double variables for the two data members. Provide an explicit value constructor with default arguments. Provide member functions for addition of two complex numbers, subtraction of two complex numbers, and printing a complex number. The printing function should output the complex number in the form a + bi where a is the real part and b is the imaginary part. The addition and subtraction functions should be set up so that the following statement would add c2 and c1 together returning the result without changing c2 and c1.
c3 = c2.add(c1);