C:\Dev-Cpp\Chapter9\newOrderedArrayListType.cpp: In member function `void orderedArrayListType<elemType>::insert(int)':
C:\Dev-Cpp\Chapter9\newOrderedArrayListType.cpp:233: error: expected primary-expression before '[' token
Execution terminated
Here is the code of this function:
1 2 3 4 5 6 7 8 9 10 11
template<class elemType>
void orderedArrayListType<elemType>::insert(int insertItem)
{
if (this->length >= this->maxSize)
cout << "The list is full." <<endl;
else
{
list<int>[this->length] = insertItem;
this->length++;
}
}
I got it working eventually!!!!
Here is the correct output:
1 2 3 4 5 6 7 8
C:\Dev-Cpp\Chapter9>arrayListType
Line 3: Enter numbers ending with -999
45 67 89 12 3 -999
Line 8: The list before sorting:
45 67 89 12 3
Line 12: The list after sorting:
3 12 45 67 89