迷宫-递归算法.pdfVIP

  • 9
  • 0
  • 约4.56千字
  • 约 2页
  • 2023-12-11 发布于宁夏
  • 举报

迷宫-递归算法

迷宫,递归实现:

1/*

2迷宫之递归,能够输出所有的路线。

3*/

4#includeiostream

5#includetime.h

6usingnamespacestd

7typedefstructPosition{

8intx

9inty

10}POSITION,*pPOSiTION

11

12intMazeMapLineNumber=0

13pPOSiTIONpMazePath

14intPathLength=0

15boolIsOutOfBorder(intx,inty)

16voidGo(pPOSiTIONpos)//将当前位置放⼊迷宫路线中

17voidTry(int**pMap,pPOSiTIONbegin,pPOSiTIONend)//开始找路

18boolShowpath()

19intmain(){

20int**pMap=NULL

21p

文档评论(0)

1亿VIP精品文档

相关文档