#include <algorithm>
#include <iostream>
#include <iterator>
using namespace std;
int main( )
{
const int num_costs = 4;
const float cost[num_costs] = { 11.11, 22.22, 33.33, 44.44 };
copy( cost, cost + num_costs,ostream_iterator<float>( cout, " " ) );
const char* fruit[] = { "A", "B", "C" };
copy( fruit, fruit + sizeof( fruit ) / sizeof( fruit[0] ),
ostream_iterator<const char*>( cout, " " ) );
int year[] = { 2001, 2002, 2003, 2004, 2005 };
const int num_years = sizeof( year ) / sizeof( year[0] );
copy( year, year + num_years,ostream_iterator<int>( cout, " " ) );
sort( year, year + num_years );
copy( year, year + num_years,ostream_iterator<int>( cout, " " ) );
reverse( year, year + num_years );
copy( year, year + num_years,ostream_iterator<int>( cout, " " ) );
}
|