having problem with the this problem


Using C++ to:

Handling Priorities with Linked Lists:

Design a class called supportTicket that handles information about reported IT support issues. A ticket includes an id number, the location of the equipment (e.g., building and room number), a short description of the issue, and a priority level. A valid priority level is a value from 1-5. Tickets are services based on their priority level, from highest to lowest. More than one ticket may have the same priority level. However, when entering an item into the list that has the same priority as another item, the newest item should come after any previously entered items with the same priority. When a ticket is serviced, it is removed from the list.

Implement a menu system that allows the program user to add a support ticket, service a ticket (remove it from list), and list active tickets in order of priority.
std::list is a linked list. std::list has sort(): http://www.cplusplus.com/reference/list/list/sort/

std::list<supportTicket> tickets;

You could either
add bool operator< (const supportTicket&, const supportTicket&);
and use tickets.sort();

or create a predicate functor (function, object or lambda that can be used as comp)
and use tickets.sort(pred);


Is the ID of new ticket always larger than ID of any older ticket?
If yes, then a<b,
IF a.priority > b.priority
OR same priority and a.id < b.id
Topic archived. No new replies allowed.