Hola buenas , voy directo al grano , llevo ya dandole vueltas a como ordenar una estructura  y nada me da errores y tal , os pongo el codigo , yo por ahora no encuentro el fallo
//OS PONGO TAMBIEN EL CARGAR Y MOSTRAR NO VAYA A SER QUE ESTE AHI EL FALLO .
//BIBLIOTECAS
#include <iostream>
using namespace std;
#include <string>
#include <fstream>
//VARIABLES CONSTANTES Y DEFINICIONES TYPEDEF
const int MAX_JUGADORES = 10;
typedef struct{
   string name;
   float puntuacion;
}tJugador;
//PROTOTIPOS
int cargarLista(tJugador players[]);
void mostrar(tJugador players[] , int num);
void ordenar(tJugador player[]);
//PROGRMA
int cargarLista(tJugador players[]){
ifstream cargar;
   bool centinela;
   int contador, numJugadores;
   contador= 0;
   numJugadores = 0;
   centinela = false;
   cargar.open("top.txt");
   if (cargar.is_open()) {
      cargar >> players[contador].name;
      if (players[contador].name == "-1")//-1 centinela
         centinela = true;
      while ((centinela == false) && (num < MAX_JUGADORES)) {
         cargar >> players[contador].puntuacion;
         contador++;
         numJugadores++;
         cargar >> players[contador].name;
         if (players[contador].name == "-1")
            centinela = true;
      }
   }
   else  cout << "Error al cargar el fichero" << endl;
   cargar.close();
return numJugadores;//PODRIAMOS DEVOLVER DIRECTAMENTE LA VARIABLE contador.
}
void mostrar(tJugador players[] , int num){
for(int contador = 0; contador < num; contador++) {
            cout << players[contador].name << "  " << players[contador].puntuacion << endl;
         }
         cout << endl;
}
void ordenar(tJugador player[]){
//-------------- Método de ordenación -----------------------------
         for (int contador = 0; contador < MAX_JUGADORES - 1; contador++) {  //SERIA MAX_JUGADORES O LE PASO LA VARIABLE NUM?
         // Desde el primer elemento hasta el penúltimo
            for (int j = MAX_JUGADORES - 1; j > contador; j--) {
            // Desde el último hasta el siguiente a contador
               if (players[cont].puntuacion < lista[cont - 1].puntuacion) {
                  int tmp;
                  tmp = players[cont].puntuacion;
                  players[cont].puntacion = players[cont - 1].puntuacion;
                  players[cont - 1].puntuacion = tmp;
               }
            }
         }
         //-----------------------------------------------------------------
}
//MAIN
int main(){
int num =0;
tJugador players[MAX_JUGADORES + 1];
   //+1 debido a que contacmos con el jugador conectado.
num=cargarLista(players);
ordenar(players)
mostrar(players, num)
return 0;
}
//FICHERO
el fichero top.txt seria :
daniel 99
alfonso 77
pedro 100
laura 5
-1
//PUEDE QUE HABER ALGUN ERROR DE SINTAXIS , DEFINICION O ALGUN CARACTER , POR QUE LO HECHO POR ENCIMA , LA COSA ES SI EL ALGORITMO ESTA BIEN PLANTEADO


 
  




 Autor
 Autor
		


 En línea
									En línea
								






 
						