Ok. First of all, you dont require Node and selectionSortLinked and swap.
Since you are supposed to implement list using arrays (according to the .h file).
The implementations of insert, remove, etc look ok.
In main(), you are calling them wrong.
For eg, insert takes 2nd parameter as ListItemType (which is typedef as string).
However you are sending an array of integers.
Similarly, give correct values for all the functions you are calling from main().
One more thing. The 3rd parameter is bool& success. It is a reference.
May be you want to read up reference variables and their usage in function parameters.
Usually, we pass something as reference so that the value can reflect at the calling location as well. Means, if the value of success is modified inside the function, that will affect the value of the variable at the calling location as well. In this context, they are using this reference variable instead of return values. So you might want to send a variable in the calling function and then check its value to make sure that the function call is successful. Something like..
1 2 3 4
|
bool succ = false;
myArrayList.remove(1,succ);
if(succ==false)
cout<<"Remove was not successful"<<endl;
| |