valarray::operator%=
取得區分陣列元素的下一個項目會根據指定的 valarray 或元素型別的值。
valarray<Type>& operator%=(
const valarray<Type>& _Right
);
valarray<Type>& operator%=(
const Type& _Right
);
參數
- _Right
項目型別的 valarray 或值與是將 valarray 的運算元,項目, valarray 的運算元。
傳回值
項目是從這個運算元項目除法運算的餘數 valarray 由 _Right.的 valarray
範例
// valarray_class_op_rem.cpp
// compile with: /EHsc
#include <valarray>
#include <iostream>
int main( )
{
using namespace std;
int i;
valarray<int> vaL ( 6 ), vaR ( 6 );
for ( i = 0 ; i < 6 ; i += 2 )
vaL [ i ] = 53;
for ( i = 1 ; i < 6 ; i += 2 )
vaL [ i ] = -67;
for ( i = 0 ; i < 6 ; i++ )
vaR [ i ] = 3*i+1;
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 remainders from the element-by-element "
<< "division is the\n valarray: ( ";
for ( i = 0 ; i < 6 ; i++ )
cout << vaL [ i ] << " ";
cout << ")." << endl;
}
需求
標題: <valarray>
命名空間: std