// includes
#include <iostream.h>
#include <complex.h>
// prototypes
// defines
#define SKIPLINE cout<<endl
///////////////////////////////////////////////////////////////////
// Programmer: L A Vercoe complex.cpp
// Date Due: 10/20/97
// Input: complex values, be sure to use complex.h
// Process: do some complex complications
// Output: complex numbers
//
int main(){
//declarations
complex z,z1,z2, i = complex(0,1);
double x,y;
//heading
cout<<"\tComplex numbers"<<endl;
//input
cout<<"Enter in a complex value as realpart: ";
cin >>x;
cout<<"\tand the imaginary part: ";
cin>>y; z = complex(x,y);
cout<<"Input as complex number (x,y) ";
cin>>z2;
//<<<process & output>>> do some complex calculations
cout<<"C's way to output complex numbers: " <<z<<endl;
cout<<"Another way to output z: "<<real(z2)<<"+"<<imag(z2)<<"i"<<endl;
cout<<"Multiply z by 2 + 3i = "<<complex(2,3)*z<<endl;
z1 = sqrt(z);
cout<<"Square root of z is "<<z1<<endl;
cout<<"Sin(z) = "<<sin(z)<<endl;
cout<<"2^z = "<<pow(2,z)<<endl;
cout<<"e^(pi*i) +1 ="<<exp(M_PI*i)+1<<endl;
//wrap up
cout<<endl<<"End of program";
}//main()