Bubble Sort + enum
#4

Well it does work with any enum and any variable (strings are only sorted by the first char)
pawn Код:
enum eListInfo { l_int, l_str[10], Float:l_float }

new List[][eListInfo] = {
    {2,"Test2",2.2},
    {1,"Test1",1.1},
    {4,"Test4",4.4},
    {3,"Test3",3.3},
    {5,"Test5",5.5}
};

enum eDataInfo { d_int, d_str[10], Float:d_float }

new Data[][eDataInfo] = {
    {7,"Test3",1.1},
    {4,"Test2",8.8},
    {2,"Test5",3.3},
    {8,"Test6",5.5},
    {6,"Test9",7.7}
};

public OnFilterScriptInit() {
    BubbleSort(List, l_int);
    for(new i;i<sizeof(List);i++) printf("%d %s %.f",List[i][l_int],List[i][l_str],List[i][l_float]);
    BubbleSort(Data, d_float);
    for(new i;i<sizeof(Data);i++) printf("%d %s %.f",Data[i][d_int],Data[i][d_str],Data[i][d_float]);
}
If that is still the wrong thing could you explain it a bit more in depth ?
Reply


Messages In This Thread
Bubble Sort + enum - by ATomas - 14.03.2014, 13:45
AW: Bubble Sort + enum - by Nero_3D - 14.03.2014, 16:53
Re: Bubble Sort + enum - by ATomas - 14.03.2014, 19:36
AW: Bubble Sort + enum - by Nero_3D - 14.03.2014, 20:41
Re: Bubble Sort + enum - by ATomas - 14.03.2014, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)