C++ Help


ifstream file("highscores.txt");
int scores[100],i=0;
while(file>>scores[i++]);

int tmp;
for(int j=0;j<i-1;j++)
  for(int k=j+1;k<i;k++)
    if(scores[j]<scores[k])
      {
          tmp = scores[j];
          scores[j] = scores[k];
          scores[k] = tmp;
       } //sorting from higher to lower

and then you can cout the entire array in a for()

file.close();

–i don’t know if this code workx, cause i’ve made it up just right now (haven’t tested)
–highscores.txt should contain the scores separated by a new line (’
') or by space