C/Visual C - URgeNtEE!!!!

 
Vista:

URgeNtEE!!!!

Publicado por Diego f (4 intervenciones) el 04/03/2002 10:29:34
Me enfrento a un enorme problema de arboles binarios en c y para terminar mi aplicacion se me hace urgente implementar el codigo de del problema de las torres de janoi de antemano muchisimas gracias por la ayuda...
chau
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:URgeNtEE!!!!

Publicado por Ne0 (1 intervención) el 04/03/2002 13:04:28
/* C0D3D By Ne0Ph03n1x for the bitches*/
#include <stdio.h>
#include <conio.h>
void hanoi(float n, float detorre,float haciatorre, float utiltorre);
main ()
{
float nt,dt,ht,ut,res;
clrscr ();
printf("\n DAME EL NUMERO DE FICHAS");
scanf ("%f", &nt);
printf ("\n DE QUE TORRE QUIERES MOVER LAS FICHAS");
scanf("%f",&dt);
printf("\n HACIA QUE TORRE QUIERES MOVER");
scanf ("%f",&ht);
printf("\n UTILIZANDO QUE TORRE");
scanf("%f",&ut);
hanoi (nt,dt,ht,ut);

getch();
return(0);
}
int RENGLON= 1,CUENTA=0;
void hanoi ( float n, float detorre, float haciatorre, float utiltorre)
{
if (n>1)
{
hanoi (n-1, detorre, utiltorre,haciatorre);
printf("\n%d.- mueve disco de %f hacia %f",CUENTA++,detorre,haciatorre);
RENGLON ++;
if (RENGLON==25)
{
getch ();
RENGLON=1;
}
hanoi (n-1, utiltorre, haciatorre, detorre);
}

else
{
printf("\n%d.- mueve disco de %f hacia %f ",CUENTA++,detorre,haciatorre);
RENGLON++;
if(RENGLON==25)
{
getch ();
RENGLON=1;
}

}

}

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar