Group PAG
/
PAG-CourseWork-NicksEdits
Minor fixes
Fork of Coursework by
Revision 44:2b23c7407547, committed 2017-05-04
- Comitter:
- noutram
- Date:
- Thu May 04 14:54:07 2017 +0000
- Parent:
- 43:4ddc392dd0cc
- Commit message:
- Now builds - Queue was the name of an existing class
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyQueue.cpp Thu May 04 14:54:07 2017 +0000 @@ -0,0 +1,44 @@ +#include "MyQueue.h" + + +MyQueue::MyQueue(){ + maxSize = 120; + front = 0; + back = 0; + isFull = false; + storage = new Reading[maxSize]; +} + +void MyQueue::push(Reading r){ + //if it is full then the front must move. if front is max then it must become 0 + if (isFull == true){ + if (front == maxSize-1){ + front = 0; + } + else{ + front = front +1; + } + back = back +1; + storage[back] = r; + } + + //otherwise the MyQueue is full + else { + + } +} +void MyQueue::read(int nR){// where nR is the number to read, if REAL ALL is typed then the method will be called by something like MyQueue.read(MyQueue.count). + if (front>back){ + for( int a = back; a >=0; a = a - 1 ) { + //print or cout? do until end of loop - think about how to loop over + } + } + for( int a = maxSize-1; a >front; a = a + 1 ) { + //print or cout? do until end of loop - think about how to loop over + } +} + +void MyQueue::deleteRecords(int nD){ //as above but nD is number to delete + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyQueue.h Thu May 04 14:54:07 2017 +0000 @@ -0,0 +1,29 @@ +#ifndef Queue_H +#define Queue_H +#include "Reading.h" + +class MyQueue{ + //variables + public: + int maxSize; + int front; + int back; + int count; + bool isFull; + Reading *storage; + + + //realisticly what we need:: + //read values taking argument n + //read values taking no argument + //take value and put it in the right place + //delete with argument + //delete without argument + + MyQueue(); + void push(Reading r); + void read(int nR); // where nR is the number to read, if REAL ALL is typed then the method will be called by something like queue.read(queue.count). + void deleteRecords(int nD); //as above but nD is number to delete + +}; +#endif \ No newline at end of file
--- a/Queue.cpp Thu May 04 12:55:16 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#include "Queue.h" - -Queue::Queue(int i){ - front = 0; - back = 0; - isFull = false; - storage = new Measure[i]; - } - -Queue::Queue(){ - front = 0; - back = 0; - isFull = false; - storage = new Measure[maxSize]; -} - -void Queue::push(Reading r){ - //if it is full then the front must move. if front is max then it must become 0 - if (isFull == true){ - if (front == maxSize-1){ - front = 0; - } - else{ - front = front +1; - } - - } - back = back +1; - storage[back] = r; - //otherwise the queue is full - else{ - - } -} -void Queue::read(int nR){// where nR is the number to read, if REAL ALL is typed then the method will be called by something like queue.read(Queue.count). - if (front>back){ - for( int a = back; a >=0; a = a - 1 ) { - //print or cout? do until end of loop - think about how to loop over - } - } - for( int a = maxSize-1; a >front; a = a + 1 ) { - //print or cout? do until end of loop - think about how to loop over - } - - - -} -void Queue::deleteRecords(int nD){ //as above but nD is number to delete - - -} \ No newline at end of file
--- a/Queue.h Thu May 04 12:55:16 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#ifndef Queue_H -#define Queue_H -#include "Reading.h" - -class Queue{ - //variables - public: - const int maxSize = 120; - int front; - int back; - int count; - bool isFull; - Reading *storage; - - - //realisticly what we need:: - //read values taking argument n - //read values taking no argument - //take value and put it in the right place - //delete with argument - //delete without argument - - Queue(int i); - Queue(); - void push(Reading r); - void read(int nR); // where nR is the number to read, if REAL ALL is typed then the method will be called by something like queue.read(queue.count). - void deleteRecords(int nD); //as above but nD is number to delete - -}; -#endif \ No newline at end of file