8) Sorting - C++ You have this function that sorts any vector of char data: void good_bubble(vector...
Fantastic news! We've Found the answer you've been seeking!
Question:
8) Sorting - C++
You have this function that sorts any vector of char data:
void good_bubble(vector& data, vector ::size_type start, vector ::size_type end) { vector ::size_type loop{0}, cur; bool done{false}; while (loop <= end-start+1 && !done) { done = true; for (cur = start; cur <= end-1-loop; ++cur) { if (data[cur] > data[cur+1]) { swap(data[cur], data[cur+1]); done = false; } } ++loop; } return; }
But now you have to sort Date objects! As luck would have it,the Date class provides the method:
bool Date::greater(const Date & other) const;
Please show your changes to only the lines from above that wouldneed to change to make your overload of good_bubble sort a vectorof Date objects.
Related Book For
Posted Date: