I kepp getting errors in my following code
#include <iostream>
#include <queue>
#include <ctime>
using namespace std;
template <class TYPE>
void randomInit (TYPE array[], int size, int mod) {
for (int i = 0; i < size; i++) {
array[i] = rand()%mod;
}
}
// Prints Array
template <class TYPE>
void printArray (TYPE array[], int size) {
cout << "{ ";
for (int i = 0; i < size; i++) {
cout << array[i] << ", ";
}
cout << "\b\b}" << endl;
}
void radixSort (int array[], int n) {
register int i, j, k, factor;
const int radix=10;
const int digits=10; //the maximum number of digits for a long
Queue<array> queues[radix]; //integer;
for(i=0, factor=1; i<digits; factor *=radix, i++)
{
for(j=0; j<n; j++)
queues[(array[j]/factor)%radix].enqueue(array[j]);
for(j=k=0; j<radix; j++)
while(!queues[j].empty())
data[k++]=queues[j].dequeue();
}
}
void main () {
srand(time(NULL));
// Locals
time_t initial = time(NULL);
time_t final;
#define SIZE 10
#define MOD 10000
int array[SIZE];
randomInit(array, SIZE, MOD);
// Sort & Print Integer Array
initial = time(NULL);
cout << "Unsorted: ";
printArray(array, SIZE);
cout << endl;
radixSort(array, SIZE);
cout << "\n Sorted: ";
printArray(array, SIZE);
cout << endl;
final = time(NULL);
cout << "time: " << final-initial << "sec" << endl << endl;
}
the errors I am getting are:
line(29) : error C2065: 'Queue' : undeclared identifier
line(29) : error C2065: 'queues' : undeclared identifier
line(33) : error C2065: 'queues' : undeclared identifier
line(33) : error C2228: left of '.enqueue' must have class/struct/union
line(35) : error C2065: 'queues' : undeclared identifier
line(35) : error C2228: left of '.empty' must have class/struct/union
line(35) : fatal error C1903: unable to recover from previous error(s); stopping compilation
7 error(s), 0 warning(s)