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

📄 网络社团--技术文档--迷宫求解的过程演示.htm

📁 迷宫求解的过程演示.rar
💻 HTM
📖 第 1 页 / 共 3 页
字号:
            if(tFileName.IsEmpty())<BR>&nbsp;&nbsp;&nbsp; 
            return;<BR>&nbsp;&nbsp; FILE 
            *in;<BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp; 
            if ((in = fopen(tFileName.c_str(), "w+"))== NULL)<BR>&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            ShowMessage("不能打开文件!!!");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            throw(0);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; char 
            SMark[5]="Labyr";<BR>&nbsp;&nbsp; int tEdition=100;<BR>&nbsp;&nbsp; 
            fprintf(in, " %s ", SMark);<BR>&nbsp;&nbsp; fprintf(in, " %d ", 
            tEdition);<BR>&nbsp;&nbsp; fprintf(in, " %d %d ", 
            LabyrinthRow,LabyrinthCol);<BR>&nbsp;&nbsp; for(int 
            k=0;k&lt;LabyrinthRow*LabyrinthCol;k++)<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            fprintf(in, " %d ", LabyrinthData[k]);<BR>&nbsp;&nbsp; 
            FileName=tFileName;<BR>&nbsp;&nbsp; 
            IsChange=false;<BR>&nbsp;}<BR>&nbsp;__finally<BR>&nbsp;{<BR>&nbsp;&nbsp; 
            fclose(in);<BR>&nbsp;}<BR>&nbsp;}<BR>&nbsp;catch(...)<BR>&nbsp;{<BR>&nbsp; 
            return;<BR>&nbsp;}<BR>}<BR>void CLabyrinth::GetRowCol(int 
            &amp;tRow,int 
            &amp;tCol)<BR>{<BR>&nbsp;tRow=LabyrinthRow;<BR>&nbsp;tCol=LabyrinthCol;<BR>}<BR>void 
            CLabyrinth::ChangRowCol(int tRow,int 
            tCol)<BR>{<BR>&nbsp;if(tRow&gt;60||tRow&lt;10||tCol&gt;60||tRow&lt;10)<BR>&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp; 
            ShowMessage("列和行超出边界(60&gt;x&gt;10)");<BR>&nbsp;&nbsp;&nbsp; 
            return;<BR>&nbsp;&nbsp; 
            }<BR>&nbsp;LabyrinthData=NULL;<BR>&nbsp;LabyrinthCol=tCol;<BR>&nbsp;LabyrinthRow=tRow;<BR>&nbsp;SetRowCol(LabyrinthRow,LabyrinthCol);<BR>&nbsp;IsChange=true;<BR>&nbsp;Refresh();<BR>}<BR>void 
            CLabyrinth::SetState(int tRow,int tCol,int tState)<BR>{<BR>&nbsp; 
            if(tRow&gt;0&amp;&amp;tCol&gt;0&amp;&amp;tRow&lt;=LabyrinthRow&amp;&amp;tCol&lt;=LabyrinthCol)<BR>&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp; 
            if(GetState(tRow,tCol)!=STATE_ENTRY&amp;&amp;GetState(tRow,tCol)!=STATE_END)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            LabyrinthData[ConvertRC(tRow,tCol)]=tState;<BR>&nbsp;&nbsp; 
            }<BR>}</P>
            <P>void CLabyrinth::ChangeState(int OldState,int NewState,int 
            Times)<BR>{<BR>&nbsp;int tCount=0;<BR>&nbsp;for(int 
            k=0;k&lt;LabyrinthRow*LabyrinthCol;k++)<BR>&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp; 
            if(LabyrinthData[k]==OldState)<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            IsChange=true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            LabyrinthData[k]=NewState;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            tCount++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
            tCol,tRow;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            tRow=k/LabyrinthCol;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            tCol=k%LabyrinthCol;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Refresh(tRow+1,tCol+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(tCount==Times)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            return ;<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; }</P>
            <P>}</P>
            <P>bool CLabyrinth::LoadFromFile(AnsiString 
            tFileName)<BR>{<BR>&nbsp;FILE *in;<BR>&nbsp;try<BR>&nbsp; 
            {<BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp; if ((in = 
            fopen(tFileName.c_str(), "r"))== NULL)<BR>&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            ShowMessage("不能打开文件!!!");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            throw(0);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; 
            rewind(in);<BR>&nbsp;&nbsp; char&nbsp; Mark[5];<BR>&nbsp;&nbsp; 
            AnsiString SMark="Labyr";<BR>&nbsp;&nbsp; fscanf(in, " %s ", 
            Mark);<BR>&nbsp;&nbsp; AnsiString tempStr=Mark;<BR>&nbsp; 
            tempStr=tempStr.SubString(1,5);<BR>&nbsp;&nbsp; 
            if(tempStr!=SMark)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
            ShowMessage("该文件不是迷宫数据文件");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            throw(0);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; int 
            tRow,tCol;<BR>&nbsp;&nbsp; int tEdition;<BR>&nbsp;&nbsp; fscanf(in, 
            " %d ", &amp;tEdition);<BR>&nbsp;&nbsp; fscanf(in, " %d %d ", 
            &amp;tRow,&amp;tCol);<BR>&nbsp;&nbsp; 
            LabyrinthCol=tCol;<BR>&nbsp;&nbsp; LabyrinthRow=tRow;</P>
            <P>&nbsp;&nbsp; SetMemory();<BR>&nbsp;&nbsp; int 
            tState;<BR>&nbsp;&nbsp; for(int 
            k=0;k&lt;LabyrinthRow*LabyrinthCol;k++)<BR>&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            if(feof(in))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            ShowMessage("文件被破坏!!!");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            throw(0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp; fscanf(in, " %d ", 
            &amp;tState);<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            LabyrinthData[k]=tState;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; 
            FileName=tFileName;<BR>&nbsp;&nbsp; IsChange=false;</P>
            <P><BR>&nbsp;}<BR>&nbsp;__finally<BR>&nbsp;{<BR>&nbsp;&nbsp; 
            fclose(in);<BR>&nbsp;}<BR>&nbsp; }<BR>&nbsp; catch(...)<BR>&nbsp; 
            {<BR>&nbsp;&nbsp; return false;<BR>&nbsp; }<BR>}</P>
            <P><BR>bool CLabyrinth::GetNewPoint(int Direction,int &amp;tRow,int 
            &amp;tCol,int &amp;tState)<BR>{<BR>int OldCol=tCol;<BR>int 
            OldRow=tRow;<BR>switch(Direction)<BR>&nbsp;{<BR>&nbsp;&nbsp; case 1: 
            tCol=tCol;tRow=tRow-1;break;<BR>&nbsp;&nbsp; case 2: 
            tCol=tCol+1;tRow=tRow;break;<BR>&nbsp;&nbsp; case 3: 
            tCol=tCol;tRow=tRow+1;break;<BR>&nbsp;&nbsp; case 4: 
            tCol=tCol-1;tRow=tRow;break;<BR>&nbsp;&nbsp; default :return 
            false;<BR>&nbsp;}<BR>&nbsp;tState=GetState(tRow+1,tCol+1);<BR>&nbsp;if((tState==STATE_PASS||tState==STATE_END)&amp;&amp;AlreadPassList-&gt;IndexOf(Format("X:%dY:%d",ARRAYOFCONST((OldCol+1,OldRow+1))))&lt;0)//发现了新的结点<BR>&nbsp; 
            return true;<BR>&nbsp;return false;<BR>}<BR>void 
            CLabyrinth::FindResult(TPoint *tStartPoint)<BR>{<BR>&nbsp; SPoint 
            *StartSPoint;<BR>&nbsp; SPoint *CurrentSPoint;<BR>&nbsp; SPoint 
            *StopSPoint;//=new SPoint();<BR>&nbsp; TPoint StartPoint;<BR>&nbsp; 
            TPoint StopPoint;<BR>&nbsp; int tCount=0;<BR>&nbsp;&nbsp; 
            AlreadPassList-&gt;Clear();<BR>&nbsp; for(int 
            l=0;l&lt;LabyrinthRow;l++)<BR>&nbsp;&nbsp; for(int 
            k=0;k&lt;LabyrinthCol;k++)<BR>&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            if(LabyrinthData[l*LabyrinthCol+k]==STATE_ENTRY)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            StartPoint.x=k;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            StartPoint.y=l;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            tCount++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            if(LabyrinthData[l*LabyrinthCol+k]==STATE_END)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            StopPoint.x=k;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            StopPoint.y=l;&nbsp; 
            tCount++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;</P>
            <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            if(tCount==2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp; }</P>
            <P>&nbsp; if(tStartPoint!=NULL)<BR>&nbsp;&nbsp;&nbsp; 
            CurrentSPoint=new SPoint(*tStartPoint);<BR>&nbsp;&nbsp;&nbsp; 
            else<BR>&nbsp;&nbsp;&nbsp;&nbsp; CurrentSPoint=new 
            SPoint(StartPoint);<BR>&nbsp; StopSPoint=new 
            SPoint(StopPoint);<BR>&nbsp; StartSPoint=CurrentSPoint;<BR>&nbsp; 
            if(CurrentSPoint-&gt;X&gt;StopSPoint-&gt;X)<BR>&nbsp;&nbsp;&nbsp; 
            CurrentSPoint-&gt;PriorityDirection=4;<BR>&nbsp;&nbsp;&nbsp; 
            else<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint-&gt;PriorityDirection=2;</P>
            <P>&nbsp; CShed&lt;SPoint&gt;tShed;</P>
            <P>&nbsp; int NowState;<BR>&nbsp; int CX,CY;<BR>&nbsp; 
            while(1)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            if(PowerExit)<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp; do{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(PowerExit)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint-&gt;Count++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool 
            tNeedPush;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CX=CurrentSPoint-&gt;X;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CY=CurrentSPoint-&gt;Y;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            switch(CurrentSPoint-&gt;Count)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 0: 
            tNeedPush=GetNewPoint(CurrentSPoint-&gt;PriorityDirection,CY,CX,NowState); 
            break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 
            1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 
            2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 
            3:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4: 
            tNeedPush=GetNewPoint(CurrentSPoint-&gt;Count,CY,CX,NowState);break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            default: 
            tNeedPush=false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            SetState(CurrentSPoint-&gt;Y+1,CurrentSPoint-&gt;X+1,STATE_PASS);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Refresh(CurrentSPoint-&gt;Y+1,CurrentSPoint-&gt;X+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            AlreadPassList-&gt;Add(Format("X:%dY:%d",ARRAYOFCONST((CurrentSPoint-&gt;X+1,CurrentSPoint-&gt;Y+1))));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint=tShed.Pop();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(FMyEvent)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            FMyEvent(EVENT_BACKDATE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(tNeedPush)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
            OldPriorityDirection=CurrentSPoint-&gt;PriorityDirection;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            int 
            OldCount=CurrentSPoint-&gt;Count;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            SetState(CurrentSPoint-&gt;Y+1,CurrentSPoint-&gt;X+1,STATE_PASSED);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Refresh(CurrentSPoint-&gt;Y+1,CurrentSPoint-&gt;X+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            tShed.Push(CurrentSPoint);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(FMyEvent)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            FMyEvent(EVENT_PAINT);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint=new 
            SPoint(CX,CY);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(OldCount==0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint-&gt;PriorityDirection=OldPriorityDirection;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            CurrentSPoint-&gt;PriorityDirection=OldCount;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(NowState==STATE_END)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            MessageDlg("恭喜你!!!", mtInformation, TMsgDlgButtons()&lt;&lt;mbOK, 
            0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            ChangeState(STATE_PASSED,STATE_PASS);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Refresh();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(FMyEvent)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            FMyEvent(EVENT_OK);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
            }while(CurrentSPoint);<BR>&nbsp;&nbsp;&nbsp; 
            if(CurrentSPoint==NULL)//没有解<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            MessageDlg("本迷宫没有通路。", mtWarning, TMsgDlgButtons()&lt;&lt;mbOK, 
            0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            if(FMyEvent)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            FMyEvent(EVENT_OK);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            }<BR>&nbsp;&nbsp; }</P>
            <P>&nbsp; PowerExit=false;<BR>}</P>
            <P>//下面是栈的成员函数<BR>template&lt;class T&gt;<BR>__fastcall 
            CShed&lt;T&gt;::CShed()<BR>{<BR>&nbsp;List=new 
            TList();<BR>}<BR>template&lt;class T&gt; __fastcall 
            CShed&lt;T&gt;::~CShed()<BR>{<BR>&nbsp;while(List-&gt;Count)<BR>&nbsp; 
            {<BR>&nbsp;&nbsp;&nbsp; T *temp=(T 
            *)List-&gt;Items[0];<BR>&nbsp;&nbsp;&nbsp; delete 
            temp;<BR>&nbsp;&nbsp;&nbsp; List-&gt;Delete(0);<BR>&nbsp; 
            }<BR>}<BR>template&lt;class T&gt; T 
            *CShed&lt;T&gt;::Pop()<BR>{<BR>&nbsp;if(!List-&gt;Count)<BR>&nbsp;&nbsp; 
            return NULL;</P>
            <P>&nbsp; T *temp=(SPoint 
            *)List-&gt;Items[List-&gt;Count-1];<BR>&nbsp; 
            List-&gt;Delete(List-&gt;Count-1);<BR>&nbsp; return temp;</P>
            <P>&nbsp;</P>
            <P>}<BR>template&lt;class T&gt; void&nbsp; CShed&lt;T&gt;::Push(T 
            *point)<BR>{<BR>&nbsp;&nbsp; List-&gt;Add(point);</P>
            <P>}<BR>///////////////////</P>
            <P>&nbsp;</P><BR><!-- #EndEditable --></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<CENTER>
<SCRIPT language=JavaScript 
src="网络社团--技术文档--迷宫求解的过程演示.files/bottom.js"></SCRIPT>

<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
  <TBODY>
  <TR>
    <TD class=myknotse1 align=middle><BR>本网站所有资料版权归结网络社团所有<BR>&copy; 2002~2003<FONT 
      color=white size=1></FONT></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>

⌨️ 快捷键说明

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