This is the souce code for Queues, but it has so many errors. Please update this without errors and warnings. template int queue ::isDecreasing() const { if (size() < 2) return true; cout << "test" << endl; for (size_t i = 0; i < size() - 1; i++) { cout << (i + 1 + _front) % _capacity << " : " << elements[(i + 1 + _front) % _capacity] << " vvvvv " << (i + _front) % _capacity << " : " << elements[(i + _front) % _capacity] << endl; if (elements[(i + 1 + _front) % _capacity] > elements[(i + _front) % _capacity]) return false; } return true; } template size_t queue::count(const T& data) const; { size_t counter = 0; for (size_t i = 0; i < size(); i++) { cout << i << ":" << elements[(_front + i) % _capacity] << endl; if (elements[(_front + i) % _capacity] == data) counter++; } return counter; }
This is the souce code for Queues, but it has so many errors. Please update this without errors and warnings.
template<class T>
int queue <T>::isDecreasing() const
{
if (size() < 2) return true;
cout << "test" << endl;
for (size_t i = 0; i < size() - 1; i++)
{
cout << (i + 1 + _front) % _capacity << " : " << elements[(i + 1 + _front) % _capacity] << " vvvvv "
<< (i + _front) % _capacity << " : " << elements[(i + _front) % _capacity] << endl;
if (elements[(i + 1 + _front) % _capacity] > elements[(i + _front) % _capacity])
return false;
}
return true;
}
template<class T>
size_t queue<T>::count(const T& data) const;
{
size_t counter = 0;
for (size_t i = 0; i < size(); i++)
{
cout << i << ":" << elements[(_front + i) % _capacity] << endl;
if (elements[(_front + i) % _capacity] == data) counter++;
}
return counter;
}

Step by step
Solved in 2 steps with 1 images









