polar()函数,用于C ++中的复数
复数的极函数用于返回复数。
的极性()函数在C++中的复杂的头文件中定义。它采用复数的大小和相位角,并使用这些值生成一个复数。
语法
polar(mag, phase);
参数-它采用两个值,即参数,相位和要生成的复数的大小。
返回值-函数返回一个复数。
polar(0.2, 0.5) -> (0.175517,0.0958851)
示例
#include<iostream>
#include>complex.h>
using namespace std;
int main () {
cout<<"\t\tRUN 1\n";
cout<<"Complex number with magnitude: 5.2 and phase angle: 1.6 is ";
cout<<polar(5.2,1.6)<<endl;
cout<<"\t\tRUN 2\n";
cout<<"Complex number with magnitude: 0.5 and phase angle: 0.2 is ";
cout<<polar(0.5,0.2)<<endl;
cout<<"\t\tRUN 3\n";
cout<<"Complex number with magnitude: 0.2 and phase angle: 0.5 is ";
cout<<polar(0.2,0.5)<<endl;
return 0;
}输出结果
RUN 1 Complex number with magnitude: 5.2 and phase angle: 1.6 is (-0.151838,5.19778) RUN 2 Complex number with magnitude: 0.5 and phase angle: 0.2 is (0.490033,0.0993347) RUN 3 Complex number with magnitude: 0.2 and phase angle: 0.5 is (0.175517,0.0958851)
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短