仅供参考:/**
*@Title老鼠走迷宫的拓展探究
*@Author孙琨
*@Date2013-11-16
*@AtXUST
*@AllCopyrightby孙琨
*
*/
#include
usingnamespacestd;
intmaze[9][9]={//初始化迷宫,英文maze为“迷宫”
{2,2,2,2,2,2,2,2,2},
{2,0,0,0,0,0,0,0,2},
{2,0,2,2,0,2,2,0,2},
{2,0,2,0,0,2,0,0,2},
{2,0,2,0,2,0,2,0,2},
{2,0,0,0,0,0,2,0,2},
{2,2,0,2,2,0,2,2,2},
{2,0,0,0,0,0,0,0,2},
{2,2,2,2,2,2,2,2,2}
};
intstartI=1,startJ=1;//入口行列坐标
intendI=7,endJ=7;//出口行列坐标
voidvisit(inti,intj)//自动搜寻路径
{
intm,n;
maze[j]=1;
if((i==endI)&&(j==endJ))
{
cout |