1: // Created by Frank M. Carrano and Tim Henry.
2: // Copyright (c) 2013 __Pearson Education__. All rights reserved.
4: #include "ArrayList.h"
5: #include <iostream>
6: #include <string>
8: int main()
9: {
10: ListInterface<string>* listPtr = new ArrayList<string>();
11: string data[] = {"one", "two", "three", "four", "five", "six"};
12: cout << "isEmpty: returns " << listPtr->isEmpty()
13: << "; should be 1 (true)" << endl;
14: for (int i = 0; i < 6; i++)
15: {
16: if (listPtr->insert(i + 1, data[i]))
17: cout << "Inserted " << listPtr->getEntry(i + 1)
18: << " at position " << (i + 1) << endl;
19: else
20: cout << "Cannot insert " << data[i] << " at position " << (i + 1)
21: << endl;
22: } // end for
23:
24: return 0;
25: } // end main
27: /*
28: isEmpty: returns 1; should be 1 (true)
29: Inserted one at position 1
30: Inserted two at position 2
31: Inserted three at position 3
32: Inserted four at position 4
33: Inserted five at position 5
34: Cannot insert six at position 6
35: */