this is the insert function of the array linear table written in CPP. In the second if condition, there is no problem if you use listSize+1, but there is an error (non-compilation error) if you execute the listSizePP program
.void insert(int location, elementtype theElement)
{
if(location > arrayLength - 1)
cout<<"List is full."<<endl;
if(location > (listSize+1) || location < 1 )
cout<<"Please enter correct value."<<endl;
else
{
for(int n = listSize; n >= location; n--)
elements[nPP] = elements[n];
elements[location] = theElement;
listSizePP;
}
}
Is there any difference between iPP and iTune1 in the comparison operator?