汉诺塔问题

#include 
#include 
using namespace std;

void place(int pla, string from, string too, string other)
{
    cout <" << too << endl;
}
void hannuo(int plates,string from,string too,string other)
{
    if (plates==0)
    {
        return;
    }
    hannuo(plates - 1, from, other, too);
    place(plates, from, too, other);
    hannuo(plates - 1, other, too, from);
}


int main()
{
    int a;
    
    cin >> a;
    hannuo(a, "A", "C", "B");
    system("pause");
    return 0;
}

你可能感兴趣的:(汉诺塔问题)