I was saving divide by 0 for later hahah, but my queue.h is below, but the way my class is set up, he wants if the method is longer than 1 line it must be defined in the cpp so I'll inlcude the cpp also
#ifdef Testing_Queue
#include <iostream>
usingnamespace std;
#endif
class Queue
{
public:
/**
Initializes a queue of a specific size and sets
the front, rear and count all to 0.
@param size
*/
Queue (){front = rear = count = 0;}
/**
Allows a object to be added to the queue in this case
a fraction.
@param x fraction to be added
*/
void add ( QInfoType x );
/**
Allows for a object to be removed from the queue in the
rear of the queue.
@return the fraction object to be removed
*/
QInfoType remove( );
/**
Test to see if the queue is empty which if the queue
is empty, count would equal 0. If the queue is empty,
it returns true, if count is not 0, it returns false.
@return true or false if queue is empty or not
*/
bool isEmpty( ){return count == 0;}
/**
Clears the whole queue when prompted.
*/
void clear( );
enum {MAXQ = 80};
private:
QInfoType elements[MAXQ];
int front, rear, count;
};
#endif
It's for a class and usingnamespace std;float are apart of the programming ground rules for now. We submit out program online with a computer generated test code so any answer even to the smallest decimal will cause an error so converting to double from float may be a problem just for this project.
Also with the add method, I can have it named anything I want but we are required to have that particular method