-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueue.cpp
39 lines (33 loc) · 912 Bytes
/
Queue.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
35
36
37
38
39
//---------------------------------------------------------------------
// Name: Nicholas Watkins
// Project: Processing expressions based on inputed values/Prog1
// Purpose: The purpose of this file is to define methods that
// manipulate the QInfoType and make the tests that check the methods
// of this file.
//---------------------------------------------------------------------
#include "Queue.h"
void Queue::enqueue (float inVal)
{
intermediateVals[rear] = inVal;
rear = (rear + 1) % MAXQ;
count++;
}
float Queue::dequeue ()
{
float returnFloat = intermediateVals[front];
front = (front + 1) % MAXQ;
count--;
return returnFloat;
}
#ifdef TESTING_QUEUE
// ------------------------------
// Testbed main
// ------------------------------
void main()
{
Queue q;
cout << q.isEmpty() << endl;
q.enqueue(12.88);
cout << q.isEmpty() << endl << q.dequeue();
}
#endif