Yurttas/PL/OOL/Cplusplus/F/07/06/00/03/bubblesort 03.cpp

 1/*
 2   Copyright(C) 1998
 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   : January 1, 1998.
11   authorĀ : Salih Yurttas.
12
13   bubblesort_03.cpp
14*/
15
16
17#include <vector>
18#include <functional>
19
20#include <cctype>
21
22using namespace std;
23
24#include "bubblesort.h"
25
26int main(int argc, char* argv[]) {
27
28  vector<int> given_list;
29
30  get_vector_item(given_list);
31
32  char order_decision = get_char("A|D");
33
34  switch((AD)(toupper(order_decision))) {
35    case Ascending : { less<int> less;
36
37                       bubblesort(given_list,
38                                  less);
39                     }
40                     break;
41    case Descending : { greater<int> greater;
42
43                        bubblesort(given_list,
44                                   greater);
45                      }
46  }
47
48  put_vector_item(given_list);
49
50}