Sdílet prostřednictvím


operator/ (<complex>)

Rozdělí dvou komplexních čísel, jeden nebo oba z nich mohou patřit podmnožina reálných a imaginárních částí typu.

template<class Type> 
   complex<Type> operator*( 
      const complex<Type>& _Left, 
      const complex<Type>& _Right 
   ); 
template<class Type> 
   complex<Type> operator*( 
      const complex<Type>& _Left, 
      const Type& _Right 
   ); 
template<class Type> 
   complex<Type> operator*( 
      const Type& _Left, 
      const complex<Type>& _Right 
   );

Parametry

  • _Left
    Komplexní číslo nebo číslo, které je komplexní číslo, které představuje čitatel rozdělí ve jmenovateli se typ parametru / operace.

  • _Right
    Komplexní číslo nebo číslo, které je komplexní číslo, které je jmenovatel, který má být použit k rozdělení čitatel s typ parametru / operace.

Vrácená hodnota

Komplexní číslo, které je výsledkem rozdělení čitatel ve jmenovateli, hodnoty, které jsou určeny parametr vstupy.

Poznámky

Operace je přetížena, aby jednoduché aritmetické operace mohou být provedeny bez převodu data do určitého formátu.

Příklad

// complex_op_div.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 ) );
   complex <double> cs1 = cl1 / cr1;

   cout << "The left-side complex number is cl1 = " << cl1 << endl;
   cout << "The right-side complex number is cr1 = " << cr1 << endl;
   cout << "The quotient of the two complex numbers is: cs1 = cl1 /cr1 = "
        << cs1 << endl;
   double abscs1 = abs ( cs1 );
   double argcs1 = arg ( cs1 );
   cout << "The modulus of cs1 is: " << abscs1 << endl;
   cout << "The argument of cs1 is: "<< argcs1 << " radians, which is " 
        << argcs1 * 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;
   complex <double> cs2 = cl2 / cr2;

   cout << "The left-side complex number is cl2 = " << cl2 << endl;
   cout << "The right-side complex number is cr2 = " << cr2 << endl;
   cout << "The quotient of the two complex numbers is: cs2 = cl2 /cr2 = " 
        << cs2 << endl;
   double abscs2 = abs ( cs2 );
   double argcs2 = arg ( cs2 );
   cout << "The modulus of cs2 is: " << abscs2 << endl;
   cout << "The argument of cs2 is: "<< argcs2 << " radians, which is " 
        << argcs2 * 180 / pi << " degrees." << endl << endl;

   // Example of the third member function
   // type double divided by type complex<double>
   double cl3 = 5;
   complex <double> cr3 ( polar ( 3.0 , pi / 6 ) );
   complex <double> cs3 = cl3 / cr3;

   cout << "The left-side complex number is cl3 = " << cl3 << endl;
   cout << "The right-side complex number is cr3 = " << cr3 << endl;
   cout << "The quotient of the two complex numbers is: cs3 = cl3 /cr2 = "
        << cs3 << endl;
   double abscs3 = abs ( cs3 );
   double argcs3 = arg ( cs3 );
   cout << "The modulus of cs3 is: " << abscs3 << endl;
   cout << "The argument of cs3 is: "<< argcs3 << " radians, which is " 
        << argcs3 * 180 / pi << " degrees." << endl << endl;
}
  

Požadavky

Záhlaví:<komplexní>

Obor názvů: std