SearchLess
Searches for an element with a value less than the value of the sample in the sorted array.
int SearchLess(
CObject* element
) const
|
Parameters
element
[in] The sample element to search in the array.
Return Value
Example:
//--- example for CArrayObj:: SearchLess(CObject*)
#include <Arrays\ArrayObj.mqh>
//---
void OnStart()
{
CArrayObj *array=new CArrayObj;
//---
if(array==NULL)
{
printf("Object create error");
return;
}
//--- add arrays elements
//--- . . .
//--- sort array
array.Sort();
//--- create sample
CObject *sample=new CObject;
if(sample==NULL)
{
printf("Sample create error");
delete array;
return;
}
//--- set sample attributes
//--- . . .
//--- search element
if(array.SearchLess(sample)!=-1) printf("Element found");
else printf("Element not found");
//--- delete array
delete array;
}
|