Espaços nominais
Variantes
Acções

std::complex::operator+(binary), operator-(binary), operator*, operator/

Da cppreference.com
< cpp‎ | numeric‎ | complex

 
 
Biblioteca numéricos
Funções matemáticas comuns
De ponto flutuante ambiente
Números complexos
Matrizes numéricas
Pseudo-aleatório de geração de números
Tempo de compilação aritmética racional(C++11)
Genéricos operações numéricas
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
Números complexos
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
complex::complex
complex::operator=
complex::real
complex::imag
complex::operator+=
complex::operator-=
complex::operator*=
complex::operator/=
Não-membros funções
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Funções exponenciais
Original:
Exponential functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funções de poder
Original:
Power functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funções trigonométricas
Original:
Trigonometric functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
Funções hiperbólicas
Original:
Hyperbolic functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
template<class T >
complex<T> operator+(const complex<T>& lhs, const complex<T>& rhs);
(1)
template<class T >
complex<T> operator+(const complex<T>& lhs, const T& rhs);
(2)
template<class T >
complex<T> operator+(const T& lhs, const complex<T>& rhs);
(3)
template<class T >
complex<T> operator-(const complex<T>& lhs, const complex<T>& rhs);
(4)
template<class T >
complex<T> operator-(const complex<T>& lhs, const T& rhs);
(5)
template<class T >
complex<T> operator-(const T& lhs, const complex<T>& rhs);
(6)
template<class T >
complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs);
(7)
template<class T >
complex<T> operator*(const complex<T>& lhs, const T& rhs);
(8)
template<class T >
complex<T> operator*(const T& lhs, const complex<T>& rhs);
(9)
template<class T >
complex<T> operator/(const complex<T>& lhs, const complex<T>& rhs);
(10)
template<class T >
complex<T> operator/(const complex<T>& lhs, const T& rhs);
(11)
template<class T >
complex<T> operator/(const T& lhs, const complex<T>& rhs);
(12)
Implementa os operadores binários para aritmética complexa e de aritmética complexa / escalar mista. Argumentos escalares são tratados como números complexos com a parte real igual ao argumento ea parte imaginária definida para zero.
Original:
Implements the binary operators for complex arithmetic and for mixed complex/scalar arithmetic. Scalar arguments are treated as complex numbers with the real part equal to the argument and the imaginary part set to zero.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-3)
Retorna a soma de seus argumentos
Original:
Returns the sum of its arguments
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4-6)
Retorna o resultado da subtração de rhslhs
Original:
Returns the result of subtracting rhs from lhs
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7-9)
Multiplica seus argumentos
Original:
Multiplies its arguments
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
10-12)
Divide lhs por rhs
Original:
Divides lhs by rhs
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar]Parâmetros

lhs, rhs -
os argumentos: ou ambos os números complexos ou um complexo e um escalares do tipo de correspondência (float, double, longdouble)
Original:
the arguments: either both complex numbers or one complex and one scalar of matching type (float, double, longdouble)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Valor de retorno

1-3)complex<T>(lhs)+= rhs
4-6)complex<T>(lhs)-= rhs
7-9)complex<T>(lhs)*= rhs
10-12)complex<T>(lhs)/= rhs

[editar]Exemplo

#include <iostream>#include <complex>int main(){std::complex<double> c2(2, 0);std::complex<double> ci(0, 1);   std::cout<< ci <<" + "<< c2 <<" = "<< ci+c2 <<'\n'<< ci <<" * "<< ci <<" = "<< ci*ci <<'\n'<< ci <<" + "<< c2 <<" / "<< ci <<" = "<< ci+c2/ci <<'\n'<<1<<" / "<< ci <<" = "<<1./ci <<'\n';   // std::cout << 1.f/ci; // compile error// std::cout << 1/ci; // compile error}

Saída:

(0,1) + (2,0) = (2,1) (0,1) * (0,1) = (-1,0) (0,1) + (2,0) / (0,1) = (0,-1) 1 / (0,1) = (0,-1)

[editar]Veja também

atribuição composto de dois números complexos ou um complexo e um escalar
Original:
compound assignment of two complex numbers or a complex and a scalar
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)[edit]
aplica operadores unários aos números complexos
Original:
applies unary operators to complex numbers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função)[edit]
close