T
TreatmentPlant
All,
As a relative newbie to the C++ world, I am struggling with a project,
and ask some assistance please.
I would like to progressively read the contents of one array into
another array, sort the new array, return the median value and then add
the next element of the source array, sort the new array etc etc...
what I have so far... (extract)
//l_iMaxRecords is the number of elements in the OriginalArray
for(int i=0; i<l_iMaxRecords;i++)
{
float* l_fTempDataArray=new float;
for(int x=0;x<=i;x++)
l_fTempDataArray[x]=OriginalArray[x];
//I need to sort this array
sort(l_fTempDataArray);
if(i%2==1)
return l_fTempDataArray[(i+1)/2];
else
return (l_fTempDataArray[i/2]+l_fTempDataArray[(i+1)/2])/2;
}
Hopefully this will make sense to you and will be able to assist. You
might be able to tell, I need a lot of help in sorting this one out
(maybe this time I have bitten off more than i can chew?)
TIA
As a relative newbie to the C++ world, I am struggling with a project,
and ask some assistance please.
I would like to progressively read the contents of one array into
another array, sort the new array, return the median value and then add
the next element of the source array, sort the new array etc etc...
what I have so far... (extract)
//l_iMaxRecords is the number of elements in the OriginalArray
for(int i=0; i<l_iMaxRecords;i++)
{
float* l_fTempDataArray=new float;
for(int x=0;x<=i;x++)
l_fTempDataArray[x]=OriginalArray[x];
//I need to sort this array
sort(l_fTempDataArray);
if(i%2==1)
return l_fTempDataArray[(i+1)/2];
else
return (l_fTempDataArray[i/2]+l_fTempDataArray[(i+1)/2])/2;
}
Hopefully this will make sense to you and will be able to assist. You
might be able to tell, I need a lot of help in sorting this one out
(maybe this time I have bitten off more than i can chew?)
TIA