Tema: std::string
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 27/09/2010, 14:24
stiwi222
 
Fecha de Ingreso: noviembre-2009
Mensajes: 186
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: std::string

Bueno, primero una aclaracion, que es que trabajar por la noche no es bueno y te saltas pasos. realmente el código es así, aunque no varia mucho la cosa ya que el eror sigue siendo el mismo:
Código C++:
Ver original
  1. void cruce(string &hijo1, string &hijo2){
  2.  
  3.     if (NUM_ALE < TASA_CRUCE){
  4.  
  5.         int punto = (int) (NUM_ALE * LON_CROMO);
  6.  
  7.         string t1, t2;
  8.  
  9.         t1=hijo1.substr(0, punto) + hijo2.substr(punto+1, LON_CROMO);
  10.         t2=hijo2.substr(0, punto) + hijo1.substr(punto+1, LON_CROMO);
  11.  
  12.         hijo1=t1; hijo2=t1;
  13.     }
  14. }

TASA_CRUCE vale 0.45 y NUM_ALE es una macro que devuelve un float entre 0 y 1.