InsertSort

Elemento de inserções no array ordenado

bool  InsertSort(
   int  element      // Element to insert
   )

Parâmetros

element

[in]  o valor do elemento a ser inserido dentro de um array ordenado

Valor do Retorno

verdadeiro se com sucesso, falso - não pode inserir o elemento.

Exemplo

//--- example for CArrayInt::InsertSort(int)
#include <Arrays\ArrayInt.mqh>
//---
void OnStart()
  {
   CArrayInt *array=new CArrayInt;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- add arrays elements
   //--- . . .
   //--- sort array
   array.Sort();
   //--- insert element
   if(!array.InsertSort(10000))
     {
      printf("Insert error");
      delete array;
      return;
     }
   //--- delete array
   delete array;
  }