Here is the arrayList class:
template<class T>
class arrayList: public linearList<T>
{
public:
// constructor, copy constructor and destructor
arrayList(int initialCapacity = 10);
arrayList(const arrayList<T>&);
~arrayList() {
delete[] element;
}
void insert(int theIndex, const T& theElement);
protected:
T* position;
}; // end of iterator class
protected:
// additional members of arrayList
void checkIndex(int theIndex) const;
// throw illegalIndex if theIndex invalid
T* element; // 1D array to hold list elements
int arrayLength; // capacity of the 1D array
int listSize; // number of elements in list
};
dict2 read the file and store the words in the arrayList. I userrayList<char[10]>, but how can input these into the arrayList from file? The errors are indicated in the above main() function.
And in the main:
In the main function, it has the following.
arrayList<char[10]> *dict1 = new arrayList<char[10]> (1000);
int k = 0;
while (getline(fin, str)) {
dict1->insert(k, str.c_str()); // error here
k++;
}
reverseArray(dict2); // error here
Edit
I should use arrayList<string> in this case.
std::vector? Why can you not use anarrayList<std::string>?