jint goal2_sort ()
{
int pinsert;
int temp;
int y,i,in,gap;
int value;
char tmpteam[20];
int tmpplayed;
int tmppoints;
int tmpgoalsf;
int tmpgoalsa;
int tmpwon;
int tmplost;
int tmpdraw;
y = 0;
value=0;
/** sort by points **/
for (y = 1; y < MAX_TEAMS; y++)
{
while (arrdetails[y].goalsfor > arrdetails[y - 1].goalsfor)
{
strcpy(tmpteam,arrdetails[y-1].team);
tmpplayed=arrdetails[y-1].played;
tmpwon=arrdetails[y-1].won;
tmplost=arrdetails[y-1].lost;
tmpdraw=arrdetails[y-1].draw;
tmppoints=arrdetails[y-1].points;
tmpgoalsf=arrdetails[y-1].goalsfor;
tmpgoalsa=arrdetails[y-1].goalsagainst;
strcpy(arrdetails[y-1].team,arrdetails[y].team);
arrdetails[y-1].played=arrdetails[y].played;
arrdetails[y-1].won=arrdetails[y].won;
arrdetails[y-1].lost=arrdetails[y].lost;
arrdetails[y-1].draw=arrdetails[y].draw;
arrdetails[y-1].points=arrdetails[y].points;
arrdetails[y-1].goalsfor=arrdetails[y].goalsfor;
arrdetails[y-1].goalsagainst=arrdetails[y].goalsagainst;
strcpy(arrdetails[y].team,tmpteam);
arrdetails[y].played=tmpplayed;
arrdetails[y].won=tmpwon;
arrdetails[y].lost=tmplost;
arrdetails[y].draw=tmpdraw;
arrdetails[y].points=tmppoints;
arrdetails[y].goalsfor=tmpgoalsf;
arrdetails[y].goalsagainst=tmpgoalsa;
y--;
}
}
return 0;
}
My current table is
Id Team Played Won Lost Drawn GoalsF GoalsA Points
0 england 1 1 0 0 3 1 3
1 wolves 1 1 0 0 7 5 3
2 liverpool 1 0 0 1 1 1 1
3 manu 1 0 0 1 1 1 1
4 everton 0 0 0 0 0 0 0
5 chelsea 0 0 0 0 0 0 0
6 nottingham 0 0 0 0 0 0 0
7 astonv 0 0 0 0 0 0 0
8 wigan 0 0 0 0 0 0 0
9 albion 0 0 0 0 0 0 0
10 coventry 0 0 0 0 0 0 0
11 arsenal 2 0 2 0 6 10 0
Team 11 (arsenal) is meant to be swapped.
my output after using the above method is:
Id Team Played Won Lost Drawn GoalsF GoalsA Points
0 arsenal 2 0 2 0 6 10 0
1 england 1 1 0 0 3 1 3
2 liverpool 1 0 0 1 1 1 1
3 manu 1 0 0 1 1 1 1
Ç*♥ 1 ÉÌ 1 0 0 0 536854672 536854552
5 everton 0 0 0 0 0 0 0
6 chelsea 0 0 0 0 0 0 0
7 nottingham 0 0 0 0 0 0 0
8 astonv 0 0 0 0 0 0 0
9 wigan 0 0 0 0 0 0 0
10 albion 0 0 0 0 0 0 0
11 coventry 0 0 0 0 0 0 0
Any ideas why im getting: Ç ♥ 1 ÉÌ 1 0 0 0 536854672 536854552
??
Thanks