Last change
on this file since 35 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
1.7 KB
|
Line | |
---|
1 | // Testprogramma voor de studenten voor de eerste opdracht van het college
|
---|
2 | // Datastructuren: implementeer een algemene klasse Queue en verschillende
|
---|
3 | // afgeleide klassen Fifo, Lifo, MinQ, MaxQ. Gebruik hierbij virtuele
|
---|
4 | // methodes en maak gebruik van het abstracte datatype List.
|
---|
5 | // Rudy 2 september 2002
|
---|
6 |
|
---|
7 | #include "test.h"
|
---|
8 | using namespace std;
|
---|
9 |
|
---|
10 | //***************************************************************************
|
---|
11 |
|
---|
12 | void InputOutput (Queue *q)
|
---|
13 | { int Item;
|
---|
14 |
|
---|
15 | cout << "Voer positieve getallen in (negatief of nul is stoppen)\n";
|
---|
16 | do
|
---|
17 | { cin >> Item;
|
---|
18 | if (Item > 0)
|
---|
19 | q->Insert(Item);
|
---|
20 | } while (Item > 0);
|
---|
21 |
|
---|
22 | cout << "In de queue staan nu de volgende getallen (in volgorde)\n";
|
---|
23 | while (!q->IsEmpty())
|
---|
24 | cout << q->Get() << "\n";
|
---|
25 |
|
---|
26 | } // InputOutput
|
---|
27 |
|
---|
28 | //***************************************************************************
|
---|
29 |
|
---|
30 | int main ()
|
---|
31 | { int Keuze;
|
---|
32 | Queue *q;
|
---|
33 |
|
---|
34 | do
|
---|
35 | { cout << "0. Stop\n1. FifoQueue\n2. LifoQueue\n3. MinQueue\n4. MaxQueue\n";
|
---|
36 | cout << "Maak een keuze: ";
|
---|
37 | cin >> Keuze;
|
---|
38 | switch (Keuze)
|
---|
39 | { case 1: q = new Fifo;
|
---|
40 | InputOutput(q);
|
---|
41 | delete q;
|
---|
42 | break;
|
---|
43 | case 2: q = new Lifo;
|
---|
44 | InputOutput(q);
|
---|
45 | delete q;
|
---|
46 | break;
|
---|
47 | case 3: q = new MinQ;
|
---|
48 | InputOutput(q);
|
---|
49 | delete q;
|
---|
50 | break;
|
---|
51 | case 4: q = new MaxQ;
|
---|
52 | InputOutput(q);
|
---|
53 | delete q;
|
---|
54 | break;
|
---|
55 | case 0: break;
|
---|
56 | default: cout << "Verkeerde invoer. Probeer nog eens.\n";
|
---|
57 | } // switch
|
---|
58 | } while (Keuze != 0);
|
---|
59 |
|
---|
60 | return 0;
|
---|
61 |
|
---|
62 | }
|
---|
63 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.