#include
#include "Iterator.h"
int main()
{
vector channelList = { "æ°é»é¢é", "è´¢ç»é¢é", "ä½è²é¢é", "çµå½±é¢é", "é³ä¹é¢é", "åä¸é¢é", "åå·å«è§", "æé½å«è§" };
// å建çµè§
Television *tv = new Television(channelList);
// åå»ºé¥æ§å¨
Iterator *remoteControl = tv->createIterator();
// 顺åºéå
printf("顺åºéå:\n");
remoteControl->first();
// éåçµè§ææé¢é
while (remoteControl->hasNext()){
remoteControl->currentChannel();
remoteControl->next();
}
printf("\n\n");
// éåºéå
printf("éåºéå:\n");
remoteControl->last();
// éåçµè§ææé¢é
while (remoteControl->hasPrevious()){
remoteControl->currentChannel();
remoteControl->previous();
}
printf("\n\n");
system("pause");
delete tv;
delete remoteControl;
return 0;
}