I'm trying to write a program in complex arithmatic for my math class. The text I have gives me the following for addition:
typedef struct FCOMPLEX {float r,i;} fcomplex;
fcomplex Cadd(fcomplex a, fcomplex b)
{
fcomplex c;
c.r=a.r+b.r;
c.i=a.i+b.i;
return c;
}
but my compiler refuses to accept it. it gives me the following:
non-local function `main()::fcomplex Cadd(main()::FCOMPLEX, main()::FCOMPLEX)' uses
and then proceeds to tell me that my variables are neither int, double, nor float.
I have iomanip, iostream, and cmath as my included libraries. One of my books doesn't even list complex arithmatic while the other only shows me the various code pieces. I can't figure out how to make the program do what I want it to do. Help?
Thanks!