- #1
- 30
- 6
Hi there. I have been trying to implement complex.h library to make some calculations in c++.Anyways I am not sure why mi compiler does not run my code at all.
Codeblocks says:
Error: expected initializer before z
Error: z was not declared in this scope
I am really confused because even in cpp.com this procedure for imaginary numbers is given.
If you could help me with how may I use, I would be really grateful.
Thanks a lot
C:
#include <iostream>
#include <complex.h>
#include <stdio.h>
using namespace std;
int main()
{
double complex z = CMPLX(0.0, -0.0);
cout<<" z = "<<creal(z)<<" + " <<cimag(z)<<endl;
return 0;
}
Error: expected initializer before z
Error: z was not declared in this scope
I am really confused because even in cpp.com this procedure for imaginary numbers is given.
If you could help me with how may I use, I would be really grateful.
Thanks a lot
Last edited by a moderator: