Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/05/2013, 08:12
mariamgn
 
Fecha de Ingreso: noviembre-2012
Mensajes: 12
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: Ordenar vector con struct?

Hola, mira a la hora se hacer el Sort(..) utilizo la funcion Compare, pero es que tengo que hacer las comparaciones como dice el ejemplo:

bool compare(date x, date y )
{
if ( x.a > y.a ) return true;
else if ( x.a < y.a ) return false;
return 0;
}

tengo
a = 5; b = 8 ;
a = 5; b = 2 ;
a = 6; b = 8 ;
a = 4; b = 3 ;
a = 4; b = 65 ;

la salida deberia ser:
4 3
4 65
5 2
5 8
6 8