Compartir a través de


valarray::operator/=

Divide un elemento-sabio valarray de operando por los elementos de un valarray especificada o un valor de tipo de elemento.

valarray<Type>& operator/=(
   const valarray<Type>& _Right
);
valarray<Type>& operator/=(
   const Type& _Right
);

Parámetros

  • _Right
    El valarray o el valor de un tipo de elemento idéntico al del operando valarray que debe dividirse, elemento-sabio, en el operando valarray.

Valor devuelto

Un valarray cuyos elementos son el cociente elemento-sabio de valarray de operando dividido por _Right.

Ejemplo

// valarray_op_ediv.cpp
// compile with: /EHsc
#include <valarray>
#include <iostream>

int main( )
{
   using namespace std;
   int i;

   valarray<double> vaL ( 6 ), vaR ( 6 );
   for ( i = 0 ; i < 6 ; i += 2 )
      vaL [ i ] =  100;
   for ( i = 1 ; i < 6 ; i += 2 )
      vaL [ i ] =  -100;
   for ( i = 0 ; i < 6 ; i++ )
      vaR [ i ] =  2*i;
   
   cout << "The initial valarray is: ( ";
      for (i = 0 ; i < 6 ; i++ )
         cout << vaL [ i ] << " ";
   cout << ")." << endl;

   cout << "The initial Right valarray is: ( ";
      for (i = 0 ; i < 6 ; i++ )
         cout << vaR [ i ] << " ";
   cout << ")." << endl;

   vaL /= vaR;
   cout << "The element-by-element result of "
        << "the quotient is the\n valarray: ( ";
      for (i = 0 ; i < 6 ; i++ )
         cout << vaL [ i ] << " ";
   cout << ")." << endl;
}
  
  
  

Requisitos

encabezado: <valarray>

espacio de nombres: std

Vea también

Referencia

valarray Class