分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.youkuaiyun.com/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
// Hanoi.cpp : Defines the entry point for the console application.//#include "stdafx.h"//#include <stdio.h> int main() { void hanoi(int n,char one,char two,char three); // 对hanoi函数的声明 int m; printf("input the number of diskes:"); scanf("%d",&m); printf("The step to move %d diskes:\n",m); hanoi(m,'A','B','C'); return 0;} void hanoi(int n,char one,char two,char three) // 定义hanoi函数 // 将n个盘从one座借助two座,移到three座 { //void move(char x,char y); // 对move函数的声明 if(n==1) //move(one,three); printf("%d:%c->%c\n",n,one,three); else { hanoi(n-1,one,three,two); //move(one,three); printf("%d:%c->%c\n",n,one,three); hanoi(n-1,two,one,three); } } /*input the number of diskes:3The step to move 3 diskes:1:A->C2:A->B1:C->B3:A->C1:B->A2:B->C1:A->CPress any key to continue*/
给我老师的人工智能教程打call!http://blog.youkuaiyun.com/jiangjunshow
