complextest

complextest -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** @file complextest.cpp @author William Duncan @date 2005-10-01 Description: program to test the complex class implementation Course: CS1254.02 Logon ID: cs1254xx Lab #: 2 Instructor: William Duncan */ #include <iostream> #include "complex.h" #include <cstdlib> using namespace std; int main(int argc, char **argv) { Complex z1(4,-2); Complex z2(-4,2); Complex z3(-4,-3); Complex z4(3,-4); Complex z5; Complex z6; Complex z7; double ang; cout<<"z1 = "<<z1<<endl; cout<<"z2 = "<<z2<<endl; cout<<"z3 = "<<z3<<endl; cout<<"z4 = "<<z4<<endl; cout<<"z2 x z3 = "<<z2*z3<<endl; cout<<"z1 + z2 = "<<z1+z2<<endl; cout<<"z3 = "<<z3<<endl; cout<<"z4 = "<<z4<<endl; cout<<"z3-z4 = "<<z3-z4<<endl; cout<<"((z2+z3)x(z3-z4)) = "; cout<<(z2+z3)*(z3-z4)<<endl; cout<<"((z2+z3)x(z3-z4))/z3 = "; z6 = ((z2+z3)*(z3-z4))/z3;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout&lt;&lt;z6&lt;&lt;endl; cout&lt;&lt;&quot;z3 / z4 = &quot;&lt;&lt;(z3/z4)&lt;&lt;endl; cout&lt;&lt;&quot;Conj(z4) = &quot;&lt;&lt;z4.conjugate()&lt;&lt;endl; cout&lt;&lt;&quot;The real part of the conjugate of z4 is &quot;&lt;&lt;(z4.conjugate()).getReal()&lt;&lt;endl; cout&lt;&lt;&quot;The imaginary part of the conjugate of z4 is &quot;&lt;&lt;(z4.conjugate()).getImag()&lt;&lt;endl; cout&lt;&lt;&quot;The angle of the conjugate of z4 is &quot;&lt;&lt;(z4.conjugate()).angle()&lt;&lt;&quot;.&quot;&lt;&lt;endl; cout&lt;&lt;&quot;The magnitude of the conjugate of z4 is &quot;&lt;&lt;(z4.conjugate()).magnitude()&lt;&lt;&quot;.&quot;&lt;&lt;endl; cout&lt;&lt;&quot;(z3*conj(z4))/(z4*conj(z4))= &quot;; cout&lt;&lt;(z3*z4.conjugate())/(z4*z4.conjugate())&lt;&lt;endl; /* Add statement here to compute ((z1-z2).(z3/z4))/(z4/z3) and print the result:*/ ang = (z1+z2).angle(); /* Put a comment here explaining what happened and why? */ return 0; }...
View Full 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 / 2

complextest -...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online