/* * complex number ADT */ #include #include #include "complex.h" /* function to add two complex numbers and return the sum */ complex_t add_c(complex_t c1, complex_t c2) { complex_t c_sum; printf("modified\n"); c_sum.real = c1.real + c2.real; c_sum.imag = c1.imag + c2.imag; return(c_sum); /* returns a complex number */ } /* function to subtract two complex numbers and return difference */ complex_t sub_c(complex_t c1, complex_t c2) { complex_t c_diff; c_diff.real = c1.real - c2.real; c_diff.imag = c1.imag - c2.imag; return(c_diff); } /* function to multiply two complex numbers and return product */ complex_t mult_c(complex_t c1, complex_t c2) { complex_t c_prod; c_prod.real = (c1.real * c2.real) - (c1.imag * c2.imag); c_prod.imag = (c1.real * c2.imag) + (c1.imag * c2.real) ; return(c_prod); }