complex

complex - NON-MEMBER FUNCTIONS. */ class Complex { public:...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/** @file complex.h @author Randall Paul Robert (9771) @date 2005-10-01 Description: public interface for the complex number class. Course: CS1254.02 Logon ID: cs125456 Lab #: 2 Instructor: William Duncan */ #ifndef COMPLEX_H #define COMPLEX_H #include <iostream> using namespace std; /* YOUR TASK HERE IS TO GIVE THE COMPLETE DEFINITION OF THE class Complex AS DESCRIBED IN THE LAB HANDOUT. BE SURE TO INCLUDE A DESCRIPTION OF EACH OF THE METHODS. YOU WILL PROVIDE ONLY THE PUBLIC INTERFACE OF THE MEMBER FUNCTIONS, NOT THEIR DEFINITIONS. THE MEMBER FUNCTIONS WILL BE DEFINED IN THE IMPLEMENTATION FILE. DEFINE THE CLASS BELOW. ALSO GIVE THE PROTOTYPES FOR THE
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: NON-MEMBER FUNCTIONS. */ class Complex { public: Complex(); Complex(double r); Complex(double r, double i); double getReal() const; double getImag() const; Complex conjugate() const; double magnitude() const; double angle(); private: double real; double imag; }; const Complex operator +(const Complex&amp; z1, const Complex&amp; z2); const Complex operator -(const Complex&amp; z1, const Complex&amp; z2); const Complex operator /(const Complex&amp; z1, const Complex&amp; z2); const Complex operator *(const Complex&amp; z1, const Complex&amp; z2); ostream&amp; operator &lt;&lt;(ostream&amp; out, const Complex&amp; z); #endif...
View Full Document

Ask a homework question - tutors are online