I have this program I'm making that uses objects and stores them in an array. I wrote this code but it won't compile, I would like some help on how to go about it as well as any alternative that involve the quick sort method.
Function Partition(memberList:Array Of Member;start,stop:Integer):Integer;
Var pivot:Member;
Var pIndex:Integer;
var temp:Member;
Begin
start:=0;
pivot:=memberList[stop];
For pIndex:=start To stop-1 Do
Begin
If memberList[pIndex].memberNo<=pivot.memberNo Then
Begin
temp:=memberList[pIndex];
memberList[pIndex]:=memberList[pIndex-1];
memberList[pIndex-1]:=temp;
pIndex:=pIndex+1;
End;
End;
temp:=memberList[pIndex];
memberList[pIndex]:=memberList[stop];
memberList[stop]:=temp;
Partition:=pIndex;
End;
Function QuickSort(memberList:Array Of Member;start,stop:Integer):Array Of Member;
Var less:Array Of Member;
Var greater:Array Of Member;
Var pIndex:Integer;
Begin
If start<stop Then
Begin
pIndex:=Partition(memberList,start,stop);
less:=QuickSort(memberList,start,pIndex-1);
greater:=QuickSort(memberList,pIndex+1,stop);
End;
QuickSort:=less+greater;
End;