/* * cpx.h - simple complex number package * version 1: value parameters & no dynamic allocation * CSE 413 demo 11/06 HP */ #ifndef CPX_H #define CPX_H typedef struct { /* complex numbers with rectangular coordinates */ double re, im; } Complex; /* return a complex number with real part = x and imaginary = y */ Complex mk_complex(double x, double y); /* return the sum of complex numbers c and d */ Complex cpx_add(Complex c, Complex d); /* store a string represtntation of c as re+im i in s */ void cpx2str(Complex c, char s[]); #endif