plexplexplex类型的定义
typedef struct {plex _Val;plex;
plexplex”关键字来声明。例如
plex c1, c2;
plex类型的变量c1和c2。
plexplex类型运算
1. 加法c1 + c2
2. 减法c1 – c2
3. 乘法c1 c2
4. 除法c1 / c2
5. 模长cabs(c1)
6. 幅角carg(c1)
j(c1)
8. 实部creal(c1)
ag(c1)
plex类型的示例
cludecludeplex.h>
tain()
{plex c1 = 1.0 + 2.0 I;plex c2 = 3.0 – 4.0 I;
tfag(c1));tfag(c2));
plex c3 = c1 + c2;tfag(c3));
plex c4 = c1 c2;tfag(c4));
= cabs(c1);tf);
gle = carg(c1);tfgle);
plexjj(c1);tfjjagj_c1));
输出结果为
c1 = 1.000000 + 2.000000i
c2 = 3.000000 – 4.000000i
c1 + c2 = 4.000000 – 2.000000i
c1 c2 = 11.000000 + 2.000000i
c1| = 2.236068
arg(c1) = 1.107149j(c1) = 1.000000 – 2.000000i
plexplex类型。