forked from FengJungle/DesignPattern
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (32 loc) Β· 858 Bytes
/
main.cpp
File metadata and controls
39 lines (32 loc) Β· 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "Iterator.h"
int main()
{
vector<string> 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;
}