valarray::operator/=

由元素的指定valarray或元素类型的值将操作数valarray元素。

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

参数

  • _Right
    元素类型的valarray或值与将部件valarray的操作数,元素,以valarray的操作数。

返回值

元素是 _Right.部件的元素商操作数valarray的valarray

示例

// 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;
}
  
  
  

要求

标头: <valarray>

命名空间: std

请参见

参考

valarray Class