URGENTE: CÓDIGO RECURSIVO EN C++ DE LAS TORRES DE HANOI
hOLA! No se si puedan ayudarme, necesito hacer en modo recursivo en c++ las torres de hanoi, pero no se programar!!
De verdad, me urge mucho, ojalá puedan ayudarme!!
Mil gracias!!
De verdad, me urge mucho, ojalá puedan ayudarme!!
Mil gracias!!
programa recursivo de la serie de Fibonacci :
// program fibo.cpp
// written in borland c++ - ver 4.5 - 18/5/2004
#include <iomanip.h>
#include <iostream.h>
void FiboLoop()
{
long a = 1,b = 0,c = 2;
for(int i = 0;;i++)
{
c = a + b;
a = b;
b = c;
if(c < a)
break; // fuera de los valores admisibles de long
cout << setw(5) << i << " : " << setw(15) << c << endl;
}
} // FIBO LOOP
void main()
{
FiboLoop();
cout << endl << "end of program - good bye ! ! !" << endl;
} // MAIN
// program fibo.cpp
// written in borland c++ - ver 4.5 - 18/5/2004
#include <iomanip.h>
#include <iostream.h>
void FiboLoop()
{
long a = 1,b = 0,c = 2;
for(int i = 0;;i++)
{
c = a + b;
a = b;
b = c;
if(c < a)
break; // fuera de los valores admisibles de long
cout << setw(5) << i << " : " << setw(15) << c << endl;
}
} // FIBO LOOP
void main()
{
FiboLoop();
cout << endl << "end of program - good bye ! ! !" << endl;
} // MAIN
