TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
Loading...
Searching...
No Matches
main_cll.cpp
1#include "cll.h"
2using namespace std;
3
4int main() {
5 /* Test CLL */
6 cout << "----------- Test construct -----------" << endl;
7 cll list1;
8 list1.display();
9 cout << "----------- Test insert front -----------" << endl;
10 list1.insert_front(5);
11 cout << "After insert 5 at front: " << endl;
12 list1.display();
13 cout << "After insert 10 3 7 at front: " << endl;
14 list1.insert_front(10);
15 list1.insert_front(3);
16 list1.insert_front(7);
17 list1.display();
18 cout << "----------- Test insert tail -----------" << endl;
19 cout << "After insert 18 19 20 at tail: " << endl;
20 list1.insert_tail(18);
21 list1.insert_tail(19);
22 list1.insert_tail(20);
23 list1.display();
24 cout << "----------- Test find item -----------" << endl;
25 if (list1.find_item(10))
26 cout << "PASS" << endl;
27 else
28 cout << "FAIL" << endl;
29 if (!list1.find_item(30))
30 cout << "PASS" << endl;
31 else
32 cout << "FAIL" << endl;
33 cout << "----------- Test * operator -----------" << endl;
34 int value = *list1;
35 cout << "Value at *list1: " << value << endl;
36 cout << "----------- Test ++ operator -----------" << endl;
37 list1.display();
38 ++list1;
39 cout << "After ++list1: " << endl;
40 list1.display();
41
42 return 0;
43}
Definition cll.h:17
int main()
Main function.
#define endl