Yurttas/PL/OOL/Cplusplus/F/07/05/00/f 01.cpp
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_01.cpp
14*/
15
16
17#include <iostream>
18#include <iterator>
19#include <algorithm>
20#include <vector>
21#include <string>
22
23using namespace std;
24
25int main(int argc, char* argv[]) {
26
27 string a[] = {"orange",
28 "apple",
29 "plum",
30 "peach",
31 "kivi",
32 "grape",
33 "apricot",
34 "watermelon"};
35
36 vector<string> v(a, a+8);
37
38 sort(v.begin(),
39 v.end(),
40 less<string>());
41
42 copy(v.begin(),
43 v.end(),
44 ostream_iterator<string>(cout, "\n"));
45
46}