C++ 中複數的 arg() 函式
複數是表示為 a + bi 的數字,其中 a 和 b 是實數。i是該數的虛部。
幅角是正軸與複數向量的夾角。對於複數
z = x + iy 用arg(z) 表示,
若要找到複數的幅角,則該複數頭的 complex 標標頭檔案中將具有一個名為arg() 的函式。
語法
arg(complex_number);
引數
該函式將一個複數作為輸入,以計算該複數的幅角。
返回值
該函式返回複數的幅角。
例項
#include<iostream>
#include<complex.h>
using namespace std;
int main (){
double a = 12.0, b = 56.0;
complex<double> complexnumber (a, b);
cout<<"The argument of complex number "<<a<<" + i"<<b<< " is: ";
cout<<arg(complexnumber)<<endl;
return 0;
}輸出
複數 12 + i56 的幅角是:1.3597
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP