int a,b;
double temp;
int sortTheNumbers = sentenceList.size() - 1;
for (a = 0; a < sortTheNumbers; ++a)
{
for (b = 0; b < sortTheNumbers; ++b)
if(score[b] < score[b + 1])
{
temp = score[b];
score[b] = score[b + 1];
score[b + 1] = temp;
}
}
from the code above, i have managed to sort my array in descending order.
but i have a problem in modifying the code to remember the index of the score.
the output should be something like:
System.out.println(Index:"+index+" with the score"+score);
Index 3 with score 7
Index 0 with score 4
Index 2 with score 3
Index 4 with score 2
Index 1 with score 0
Anyone help me please >.< Have been hard-coding 3-4 hours nonstop for my FYP(mind became blank?) >.<