如何取复数的实部
再c语言中如何取复数的实部,要用什么的样的头文件呢?谢谢指教
[解决办法]
float _Complex a = 1.1F + 2.2iF; // 关键字_Complex;
注意2.2后的i
float a_real = __real__ a; // 关键字__real__
float a_imag = __imag__ a; // 关键字__imag__
当然,大部分的操作早已封装在标准文件 complex.h
中了。
#include <complex.h>
之后可以轻松的使用。