これが私の表示関数であり、それに関連付けられた列挙型です。
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