Question: Subject: C++ I have created a class called QueueOfIntegers in a file called QueueOfIntegers.h, which is here: #ifndef QueueOfIntegers_H #define QueueOfIntegers_H class QueueOfIntegers { public:
Subject: C++
I have created a class called QueueOfIntegers in a file called QueueOfIntegers.h, which is here:
#ifndef QueueOfIntegers_H #define QueueOfIntegers_H
class QueueOfIntegers { public: int elements[100]; //Array to store integers in the queue int size; // Number of integers in the queue
QueueOfIntegers(); // Construct an empty queue bool IsEmpty(); // Returns true if the queue is empty int Peek(); // Returns the integer at the beginning of the Queue without removing it void Enqueue(int value); // Adds an integer to the end of the Queue int Dequeue(); // Remove and returns the object at the beginning of the Queue. int GetSize(); // Returns the number of integers in the queue }; #endif
I also have another file called QueueOfIntegers.cpp that defines the functions which will need to be filled out:
#include "QueueOfIntegers.h"
QueueOfIntegers::QueueOfIntegers() { }
bool QueueOfIntegers::IsEmpty() { if (size = 0) { return true; } }
int QueueOfIntegers::Peek() { return 0; }
void QueueOfIntegers::Enqueue(int value) { return 0; }
int QueueOfIntegers::Dequeue() { return 0; }
int QueueOfIntegers::GetSize() { return size; }
I need to make an int main() function file called MainQueueOfIntegers.cpp and it needs to do the following:
- Add 10 random integers to the queue
- Use a loop to print out all integers in the queue (use IsEmpty() function)
Will be working on this tonight and tomorrow night but I could use some outside assistance. Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
