Mail Archives: djgpp/1998/01/24/21:47:56
On Tue, 20 Jan 1998 23:40:45 +0100, "Inyaki Rodríguez"
<0115561c01 AT abonados DOT cplus DOT es> wrote:
>Hi, I'm a newbie with C++ and I want to work with class Complex but I have
>some questions.
>I had write this sample program:
>
>#include <iostream.h>
>#include <complex.h>
>int main(void)
>{
> Complex z1;
> Complex z2;
> z1=complex(1,1);
> z2=complex(1.5,3);
> cout << "z1+z2= " << z1+z2 << "\n";
> cout << "z1*z2= " << z1*z2 << "\n";
> cout << "z1/z2= " << z1/z2 << "\n";
> return 0;
>}
Try rewriting it like this :
#include <iostream.h>
#include <complex.h>
int main(void)
{
float_complex z1(1,1);
float_complex z2(1.5,3);
cout << "z1+z2= " << z1+z2 << "\n";
cout << "z1*z2= " << z1*z2 << "\n";
cout << "z1/z2= " << z1/z2 << "\n";
return 0;
}
It should now compile without any problems.
I recommend having a look at the header files relating to complex
arithmetic in the lang\cxx\std directory if you get stuck again.
Hope this helps!
Regards
Andrew Laing.
- Raw text -