슬프게도 MS는 비교적 작은 사용자 기반과 mordern gcc 기반 코드를 MSVC로 이식하기 때문에 C99 라이브러리 지원을 제공하기를 열망하지 않았습니다. 우선 순위의 문제입니다.
그러나이 개발자의 요구에, 그들이 여기 언급 된 비주얼 스튜디오 위 2013에서 많은 C99 라이브러리 구현 :
그래서 https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/
을, C의 코드는 다음과 같이 쓸 수있다 :
#include <stdio.h> /* Standard Library of Input and Output */
#include <complex.h> /* Standard Library of Complex Numbers */
int main() {
double complex z1 = 1.0 + 3.0 * I;
double complex z2 = 1.0 - 4.0 * I;
printf("Initial values: Z1 = %.2f + %.2fi \nZ2 = %.2f %+.2fi\n", creal(z1), cimag(z1), creal(z2), cimag(z2));
double complex sum = z1 + z2;
printf("Sum: Z1 + Z2 = %.2f %+.2fi\n", creal(sum), cimag(sum));
double complex diff = z1 - z2;
printf("Diff: Z1 - Z2 = %.2f %+.2fi\n", creal(difference), cimag(difference));
double complex product = z1 * z2;
printf("Product: Z1 x Z2 = %.2f %+.2fi\n", creal(product), cimag(product));
double complex quotient = z1/z2;
printf("Quotient: Z1/Z2 = %.2f %+.2fi\n", creal(quotient), cimag(quotient));
double complex conjugate = conj(z1);
printf("Conjugate of Z1 = %.2f %+.2fi\n", creal(conjugate), cimag(conjugate));
return 0;
}
COS(), EXP() 및 SQRT() 함수 등
등 복잡한 형태로 교체되어야 ccos(), cexp(), csqrt() 그리고 그들은 잘 작동합니다.
다른 해결 방법은 완전히 인텔 CC 또는 GCC, 사용까지 이동 비주얼 C.
보다 합리적인 접근 방식에 작동하는 MS 컴파일러와 사용 인텔 컴파일러 (계몽하다) 긁어 수 프로그래밍 환경을위한 Eclipse. Windows-Linux-Solaris-AIX-etc에서 코드의 이식성은 일반적으로 중요하며, 불행히도 MS 도구로는 전혀 지원되지 않습니다.
핸드 롤 자신의 복잡한 클래스 –
'a'는 초기화되지 않습니다. 자세한 내용은 다음을 참조하십시오. http://en.cppreference.com/w/c/numeric/complex/Complex_I – vivekn