-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistdriver.cpp
62 lines (49 loc) · 1.32 KB
/
listdriver.cpp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//========================================================
// K M I Asif
// April 2023
// listdriver.cpp
// This file tests the List class.
//========================================================
#include <iostream>
#include "List.h"
int main ( void )
{
List<int> list1;
cout << "list1 = " << list1 << endl;
for ( int i = 1; i <= 10; i++ )
list1.append(i);
cout << "list1 = " << list1 << endl;
List<int> list2(list1);
cout << "list2 = " << list2 << endl;
cout << "\nlist1.insert(50,10);\nlist1.insert(0,0)\n";
cout << "list1.remove(1);\n";
list2[2] = 100;
list1.insert(50,10);
list1.insert(0,0);
list1.remove(1);
cout << "list2 = " << list2 << endl;
cout << "list1 = " << list1 << endl;
cout << "\nlist3 new empty\n";
List<int> list3;
cout << "list3 size = " << list3.length() << endl;
if ( list3.isEmpty() )
cout << "list3 empty\n";
else
cout << "list3 not empty\n";
cout << "\nlist3 = list1+list2\n";
list3 = list1 + list2;
cout << "list3 = " << list3 << endl;
cout << "list3 size = " << list3.length() << endl;
if ( list3.isEmpty() )
cout << "list3 empty\n";
else
cout << "list3 not empty\n";
cout << "\nlist3.clear()\n";
list3.clear();
cout << "list3 size = " << list3.length() << endl;
if ( list3.isEmpty() )
cout << "list3 empty\n";
else
cout << "list3 not empty\n";
return 0;
}