用c语言解决迷宫设计与寻找通路问题
摘 要:本课程设计主要解决设计一个迷宫以及在给出一组入口和出口的情况下,求出一条通路的问题。在课程
设计中,程序设计语言采用VisualC++6.0,数据结构采用顺序栈存储结构,程序运行平台为Windows98/2000/XP。
对于迷宫设计问题,首先假设了用“0”表示此道路可通,“1”表示不可通,即障碍,然后采用了简单的以时间
产生随机变量 (0,1变量)和人工输入0-1变量的方法产生迷宫矩阵。对求解迷宫通路问题,采用“穷举求解”
的方法和设计一个“先进后出”的栈来存放当前位置路径,最后得出一条行走迷宫的通路。在程序设计中,采用
了结构化与面向对象两种解决问题的方法。程序通过调试运行,初步实现了设计目标。
关键词 :程序设计;C++6.0;顺序栈存储结构;穷举求解
Abstract:Thiscoursedesign main solving design amaze andgiven a set ofinlet and outlet.Inthe courseofdesign.
Programming languageusedVisual C++ 6.0 .Data structureandthe storage structure order stack.Programrunning
platform for Windows98/2000/XP.For amaze designproblem.That firstwith "0"saystheroadcan connect."1"mean
not expert..Isnamely obstacles.Andthenusing simpletotimeproducerandomvariables(0, 1variables) and artificial
0-1variablemethodhasthemazematrix. Solvingtheproblem ofmazepathways.The "poor for solving"themethod
and design a "advanced after a"stack to storethecurrent positionpath.Finally draw awalk the accessofthemaze.In
programming.The structural and object-orientedtwokindsofmethodsto solvetheproblems.Program through the
debug operation.Then realizedthedesign goal.
Keywords:Program design;C++6.0;Storage structureorder stack;Poor for solving.
1
目 录
第一章 引言 …………………………………………………………………………………………………………………………………………….……..3
1.1 课程设计目的………………………………………………………………………………………………………………………….….……..….3
1.2 课程设计内容 ………………………………………………………………..………………………………………………3
1.3 概要设计 ………………………………………………………………………………………………………………………..…….…………..…3
第二章 程序设计说明 …………………………………………………………………………………………………………………….….………….5
2.1 定义抽象数据类型 ……………………………………………………………………………………………………….………………5
2.2定义栈结构体及二维数组 …………………………………………………………………….……………………….…..….…………5
2.3 主程序模块 ……………………………………………………………………………………………….……………………..………………6
第三章 详细设计实现 …………………………………………….………………………………………………………………..……….…………..7
3.1 流程图 ..…………………………………………………………………………………………………………….………………………