complex::operator/=
実際、複素数の架空のパーツとが生じる可能性がある、またはが同じ型である除数して、ターゲット複素数を分割されます。
template<class Other>
complex<Type>& operator/=(
const complex<Other>& _ComplexNum
);
complex<Type>& operator/=(
const Type& _RealPart
);
complex<Type>& operator/=(
const complex<Type>& _ComplexNum
);
パラメーター
_ComplexNum
ターゲットの複雑なから引くする複素数。_RealPart
ターゲットから引くする複素数の実数。
戻り値
パラメーターとして指定された数値で割った複素数。
解説
操作は簡単な算術演算が特定の形式のデータへの変換なしで実行できるようにオーバーロードされます。
使用例
// complex_op_de.cpp
// compile with: /EHsc
#include <complex>
#include <iostream>
int main( )
{
using namespace std;
double pi = 3.14159265359;
// Example of the first member function
// type complex<double> divided by type complex<double>
complex <double> cl1 ( polar (3.0 , pi / 6 ) );
complex <double> cr1 ( polar (2.0 , pi / 3 ) );
cout << "The left-side complex number is cl1 = " << cl1 << endl;
cout << "The right-side complex number is cr1 = " << cr1 << endl;
complex <double> cs1 = cl1 / cr1;
cout << "The quotient of the two complex numbers is: cs1 = cl1 /cr1 = "
<< cs1 << endl;
// This is equivalent to the following operation
cl1 /= cr1;
cout << "Quotient of two complex numbers is also: cl1 /= cr1 = "
<< cl1 << endl;
double abscl1 = abs ( cl1 );
double argcl1 = arg ( cl1 );
cout << "The modulus of cl1 is: " << abscl1 << endl;
cout << "The argument of cl1 is: "<< argcl1 << " radians, which is "
<< argcl1 * 180 / pi << " degrees." << endl << endl;
// Example of the second member function
// type complex<double> divided by type double
complex <double> cl2 ( polar (3.0 , pi / 6 ) );
double cr2 =5;
cout << "The left-side complex number is cl2 = " << cl2 << endl;
cout << "The right-side complex number is cr2 = " << cr2 << endl;
complex <double> cs2 = cl2 / cr2;
cout << "The quotient of the two complex numbers is: cs2 /= cl2 cr2 = "
<< cs2 << endl;
// This is equivalent to the following operation
cl2 /= cr2;
cout << "Quotient of two complex numbers is also: cl2 = /cr2 = "
<< cl2 << endl;
double abscl2 = abs ( cl2 );
double argcl2 = arg ( cl2 );
cout << "The modulus of cl2 is: " << abscl2 << endl;
cout << "The argument of cl2 is: "<< argcl2 << " radians, which is "
<< argcl2 * 180 / pi << " degrees." << endl << endl;
}
必要条件
ヘッダー: <complex>
名前空間: std