#include <iostream>
void hanoi(int disks, std::string src, std::string dest, std::string aux) {
if (disks > 0) {
hanoi(disks - 1, src, aux, dest);
std::cout << "Move disk from " << src << " to " << dest << '\n';
hanoi(disks - 1, aux, dest, src);
}
}
int main() {
int disks = 3;
std::cout << "Using " << disks << " disk/s" << '\n';
hanoi(disks, "A", "C", "B");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: