-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·62 lines (41 loc) · 949 Bytes
/
main.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
62
// main.cpp
#include <iostream>
#include "AdjustableArray.h"
using namespace std;
int main()
{
AdjustableArray a1(-1); // Non-default constructor
AdjustableArray a2; // constructor
cout << "a2: "
<< a2 // Overloaded << operator
<< endl;
AdjustableArray a3(10); // Non-default constructor
for (int i = 0; i < a3.length(); i++) {
a3[i] = i + 1; // overloaded [] operator
}
cout << "a3: "
<< a3
<< endl;
// Testing insertion and deletion
a3.insertAfter(3, 15);
cout << "a3: "
<< a3
<< endl;
a3.insertAfter(33, 100);
cout << "a3: "
<< a3
<< endl;
a3.deleteThis(2);
cout << "a3: "
<< a3
<< endl;
a3.insertAfter(1, 30);
cout << "a3: "
<< a3
<< endl;
a3.deleteThis(55);
cout << "a3: "
<< a3
<< endl;
return 0;
}