⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 用栈实现迷宫问题求解_数据结构与算法_数据结构算法_c语言_c 语言之家.htm

📁 严蔚民版的数据结构的完整课件
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">#define MAXLEN 
                              10//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">迷宫包括外墙最大行列数目</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">typedef 
                              struct{<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int r;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int c;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>char 
                              adr[MAXLEN][MAXLEN];//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可取</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">' ''*' '@' 
                              '#'<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">}MazeType;<SPAN 
                              style="mso-spacerun: yes">&nbsp;&nbsp; 
                              </SPAN>//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">迷宫类型</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">Status InitMaze(MazeType 
                              &amp;maze){<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">初始化迷宫若成功返回</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">TRUE,</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">否则返回</SPAN><SPAN 
                              lang=EN-US style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman">FALSE<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>int m,n,i,j;<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>printf("Enter row and column numbers: 
                              ");<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>scanf("%d%d",&amp;maze.r,&amp;maze.c); 
                              //</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">迷宫行和列数</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>for(i=0;i&lt;=maze.c+1;i++){//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">迷宫行外墙</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>maze.adr[0][i]='#';<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>maze.adr[maze.r+1][i]='#';<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>}//for<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>for(i=0;i&lt;=maze.r+1;i++){//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">迷宫列外墙</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>maze.adr[i][0]='#';<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>maze.adr[i][maze.c+1]='#';<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>}<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>for(i=1;i&lt;=maze.r;i++)<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>for(j=1;j&lt;=maze.c;j++)<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>maze.adr[i][j]=' ';//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">初始化迷宫</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>printf("Enter block's coordinate((-1,-1) to 
                              end): ");<o:p></o:p></FONT></SPAN></P>
                              <P class=MsoNormal 
                              style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US 
                              style="FONT-SIZE: 9pt"><FONT 
                              face="Times New Roman"><SPAN 
                              style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                              </SPAN>scanf("%d%d",&amp;m,&amp;n);//</FONT></SPAN><SPAN 
                              style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接收障碍的坐标</SPAN><SPAN 
                              lang=EN-US 
                              style="FONT-SIZE: 9pt"><o:p></o:p></SPAN></P>
                              <P class=MsoNormal 
                            

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -