STL : max_element () + min_element ()


#include #include #include using namespace std; int main () { int x [] = {2, 7, 92, 81, 19, 72, 23}; unsigned int array_length = sizeof (x) / sizeof (int); cout

Advertisements

STL: Algorithm: generate ()


#include #include using namespace std; int main () { vector v (10); // allocate space for 10 elements generate( v.begin (), v.end (), rand); // generate random numbers for ( size_t i = 0; i < v.size (); i++ ) printf ("%d\n", v [i]); return 0; } /* output 41 18467 6334 26500 19169 15724 … Continue reading STL: Algorithm: generate ()