Friday, March 21, 2014

Sorting Cointainer

// Sorting Cointainer

static void SortContainer(Args _args)
{
container con = [5,1,2,'Sangeeth B.Tech',9, 'MBA Sangeeth', NoYes::No];
str temp1;
str temp2;
int i;
int j;
container sorCon;
;

sorCon = con;

// Sort the container
    for (i = 1; i <= conlen(sorCon); i++)
    {
        for (j = i + 1; j <= conlen(sorCon); j++)
        {
            temp1 = conpeek(sorCon, j);
            temp2 = conpeek(sorCon, i);

            if (temp1 < temp2)
            {
                sorCon = condel(sorCon, j, 1);
                sorCon = conins(sorCon, j, temp2);
                sorCon = condel(sorCon, i, 1);
                sorCon = conins(sorCon, i, temp1);
            }
        }
    }

conview(sorCon);
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...