C语言复数类型 visual studio2013编译环境 小白一枚希望有人指点迷津
#include <stdio.h>#include <complex.h>
int main(void)
{
double complex cx = 1.0 + 3.0*I;
double complex cy = 1.0 - 4.0*I;
printf("Working with complex numbers:");
printf("\nStarting values:cx=%.2f%+.2fi cy=%.2f%+.2fi",
creal(cx), cimag(cx), creal(cy), cimag(cy));
double complex sum = cx + cy;
printf("\n\nThe sum cx+cy=%.2f%+.2fi",
creal(sum), cimag(sum));
double complex difference = cx - cy;
printf("\n\nThe difference cx-cy=%.2f%+.2fi",
creal(difference), cimag(difference));
double complex product = cx*cy;
printf("\n\nThe product cx*cy=%.2f%+.2fi",
creal(product), cimag(product));
double complex quotient = cx / cy;
printf("\n\nThe quotient cx/cy=%.2f%+.2fi",
creal(quotient), cimag(quotieng));
double complex conjugate = conj(cx);
printf("\n\nThe conjugate of cx=%.2f%+.2fi",
creal(conjugate), cimag(conjugate));
}
问题:希望有人可以为我找出源代码的一些错误,为我指点迷津。
[此贴子已经被作者于2017-2-15 17:11编辑过]