请输入您要查询的百科知识:

 

词条 cabs
释义

函数简介

函数名: cabs(_cabs)

功 能: 计算复数的绝对值

所属库:math.h

用 法: double _cabs(struct _complex z);

参数说明:

struct _complex 定义在math.h下

struct _complex {

double x,y; /* real and imaginary parts */

} ;

程序示例

#include <stdio.h>

#include <math.h>

int main(void)

{

struct complex z;

double val;

z.x = 2.0;

z.y = 1.0;

val = cabs(z);

printf("The absolute value of %.2lfi %.2lfj is %.2lf", z.x, z.y, val);

return 0;

}

下面的例子来自MSDN

#include <math.h>

#include <stdio.h>

int main( void )

{

struct _complex number = { 3.0, 4.0 };

double d;

d = _cabs( number );

printf( "The absolute value of %f + %fi is %f\",

number.x, number.y, d );

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/4 5:03:10