Yurttas/PL/OOL/Cplusplus/F/07/05/00/f 10.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2002
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : June 1, 2002.
11   author : Salih Yurttas.
12
13   f_10.cpp
14*/
15
16
17#include <iostream>
18#include <iterator>
19#include <algorithm>
20#include <functional>
21#include <vector>
22
23using namespace std;
24
25int main(int argc, char* argv[]) {
26
27  int a[] = {3, 1, 5, 2, 4, 6, 8, 7};
28
29  vector<int> v(a, a+8);
30
31  sort(v.begin(),
32       v.end(),
33       greater<int>());
34
35  copy(v.begin(),
36       v.end(),
37       ostream_iterator<int>(cout, "\n"));
38
39}