complex

# complex - @file [email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ Randall Paul...

This preview shows pages 1–3. Sign up to view the full content.

/** @file complex.cpp @author Randall Paul Robert (9771) @date 2005-10-01 Description: implementation for the complex class Course: CS1254.02 Logon ID: cs125456 Lab #: 2 Instructor: William Duncan */ #include <cmath> #include <cstdlib> #include <math.h> #include "complex.h" /* SOME FUNCTION HAVE BEEN IMPLEMENTED FOR YOU. IMPLEMENT ALL OTHER FUNCTIONS DESCRIBED ON THE LAB HANDOUT. */ Complex::Complex() { real = 0.0; imag = 0.0; } Complex::Complex(double r) { real = r; imag = 0; } Complex::Complex(double r, double i) { real = r; imag = i; } double Complex::getReal() const { return real; } double Complex::getImag() const { return imag; } Complex Complex::conjugate() const { Complex z; z.real = real; z.imag = -imag; return z; } double Complex::magnitude() const {

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Complex z; double rad, mag, rmag, immag; z.real = real; z.imag = imag; rmag = ((z.real)*(z.real)); immag = ((z.imag)*(z.imag)); rad = rmag + immag; mag = sqrt(rad); return mag; } double Complex::angle() { Complex z; double degree;
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

### Page1 / 3

complex - @file [email protected] Randall Paul...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online