labrab26 -> main.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "queue.h"
#include <iostream>
using namespace std;
int main()
{
QueueItem< int> * queue = NULL;
int ni = 0;
QueueItem< int> q1(ni = rand()%100);
queue = &q1;
cout << "Unsorted queue:" << endl;
cout << ni << ' ';
for (int i=0; i<20; i++)
{
ni = rand()%100;
cout << ni << ' ';
queue = queue->OrdAdd(new QueueItem< int>(ni));
}
cout << endl;
queue = queue->First();
cout << "Sorted queue:" << endl;
queue->Print();
cout << endl;
return 0;
}