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;
}
}
}