好的,这是我的显示函数,以及与之关联的枚举类型。
enum EventType {ARRIVAL = 'A', DEPARTURE = 'D'};
void EventList::display()
{
cout << "Event List: ";
for (ListNode *cur = head; cur != NULL; cur = cur->next)
{
if (cur->item.type == ARRIVAL)
cout << ARRIVAL << cur->item.beginTime << ":" << cur->item.transactionLength << " ";
else if (cur->item.type == DEPARTURE)
cout << DEPARTURE << cur->item.beginTime << " ";
}
cout << endl;
}
问题在于我想要的输出是显示 A 或 D。而不是与字母关联的整数值。我该怎么做?
Event List: 652:5 686
我想读
Event List: A2:5 D6