no constructor exists to convert datatype to queue of datatype

I'm trying to enqueue the ints and doubles for the queue of ints and the queue of doubles. But there's 2 errors of that problem. How can I fix this?

#include <iostream>
#include <iomanip>

using namespace std;

#include "QueueT.h"

template <typename T>
void print(Queue<T> st)
{
st.display(cout);
}

int main()
{
int cap;
cout << "Enter a number for the capacity of queue: \n";
cin >> cap;

Queue<int> intQ;
Queue<double> douQ;

for (int i = 0; i <= 100; i++)
intQ.enqueue(i);
for (double j = 0.0; j <= 99.9; j++)
douQ.enqueue(j);

cout << "Contents of int queue (via print): ";
print(intQ);
cout << endl;
cout << "Contents of double queue (via print): ";
print(douQ);
cout << endl;

Queue<int> i;
i = intQ;
cout << "Contents of int queue after i = intQ (via print):\n";
print(i); cout << endl;
cout << "Queue i empty? ";
if(i.empty())
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
cout << "Front value in i: " << i.front() << endl;
while (!i.empty())
{
cout << "dequeue i: " << i.front() << endl;
i.dequeue();
}
cout << "Queue i empty? ";
if(i.empty())
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
cout << "Top value in i: " << i.front() << endl;
cout << "Trying to dequeue i: " << endl;
i.dequeue();

Queue<double> d;
d = douQ;
cout << "Contents of double queue after d = intQ (via print):\n";
print(d); cout << endl;
cout << "Queue d empty? ";
if (d.empty())
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
cout << "Front value in d: " << d.front() << endl;
while (!d.empty())
{
cout << "Dequeue d: " << d.front() << endl;
d.dequeue();
}
cout << "Queue d empty? ";
if (d.empty())
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
cout << "Front value in d: " << d.front() << endl;
cout << "Trying to dequeue d: " << endl;
d.dequeue();
}

Here's the QueueT.h

#include <iostream>

#ifndef QUEUE
#define QUEUE

using namespace std;
const int QUEUE_CAPACITY = 128;
template <typename QueueElement>

class Queue
{
public:
/***** Function Members *****/
/***** Constructor *****/
Queue();
bool empty() const;
void enqueue(const Queue<QueueElement> & value);
void display(ostream & out) const;
QueueElement front() const;
void dequeue();
private:
/***** Data Members *****/
int myFront,
myBack;
QueueElement myArray[QUEUE_CAPACITY];
}; // end of class declaration

//====== FUNCTION DEFINITIONS ======
#include <new>

template <typename QueueElement>
Queue<QueueElement>::Queue()
: myFront(0), myBack(0)
{}

//--- Definition of empty()
template <typename QueueElement>
inline bool Queue<QueueElement>::empty() const
{
return (myFront == myBack);
}

//--- Definition of enqueue()
template <typename QueueElement>
inline void Queue<QueueElement>::enqueue(const Queue<QueueElement> & value)
{
int newBack = (myBack + 1) % QUEUE_CAPACITY;
if (newBack != myFront) // queue isn't full
{
myArray[myBack] = value;
myBack = newBack;
}
else
{
cerr << "*** Queue full -- can't add new value ***\n"
"Must increase value of QUEUE_CAPACITY in Queue.h\n";
exit(1);
}
}

//--- Definition of display()
template <typename QueueElement>
inline void Queue<QueueElement>::display(ostream & out) const
{
for (int i = myFront; i != myBack; i = (i + 1) % QUEUE_CAPACITY)
out << myArray[i] << " ";
cout << endl;
}

//--- Definition of front()
template <typename QueueElement>
QueueElement Queue<QueueElement>::front() const
{
if (!empty())
return (myArray[myFront]);
else
{
cerr << "*** Queue is empty -- returning garbage value ***\n";
QueueElement garbage;
return garbage;
}
}

//--- Definition of dequeue()
template <typename QueueElement>
inline void Queue<QueueElement>::dequeue()
{
if (!empty())
myFront = (myFront + 1) % QUEUE_CAPACITY;
else
{
cerr << "*** Queue is empty -- "
"can't remove a value ***\n";
exit(1);
}
}
#endif
there's 2 errors of that problem. How can I fix this?
What are the errors?
for (int i = 0; i <= 100; i++)
intQ.enqueue(i);
for (double j = 0.0; j <= 99.9; j++)
douQ.enqueue(j);


Both of them don't have any suitable constructor to convert any datatype to the queue of any datatype. That was because the queue class is controlled by a template.
void enqueue(const Queue<QueueElement> & value);

The argument to enqueue should be const QueueElement& value.
Let me fix this error and I'll have the updates. Thanks.
Topic archived. No new replies allowed.