# multiply by 100 to get a percent : bind2nd « STL Algorithms Helper « C++

multiply by 100 to get a percent

```
#include <algorithm>
#include <functional>
#include <iomanip>
#include <vector>
#include <iostream>

using namespace std;

template <class T>
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}

int main()
{
const float d1[] = { 1.11, 2.22, 3.33, 4.44, 5.55 };
const float d2[] = { 6.66, 7.77, 8.88, 9.99, 1.11 };

vector<float> v2( d2,d2 + sizeof( d2 ) / sizeof( d2[0] ) );
vector<float> v1( d1,d1 + sizeof( d1 ) / sizeof( d1[0] ) );

vector<float> change( v2.size() );

// multiply by 100 to get a percent
transform( change.begin(), change.end(), change.begin(),bind2nd( multiplies<float>(), 100.0f ) );

print( change );
}

```

### Related examples in the same category

 1 Demonstrate bind2nd() 2 Use the generic count algorithm with predicate: Determine the number of array elements that are not equal to 1 3 transform, bind2nd and modulus 4 transform, bind2nd and plus 5 Count vowels in a sentence