소개글
C로 쓴 자료구조론 에 나오는 미로찾기 알고리즘을 이용하여 구현한 프로그램 입니다. 실행 이상없이 잘 됩니다.
목차
총 4파일
stack.h
maze.txt
maze.cpp
stack.cpp
본문내용
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
void main()
{
short int maze[13][17];
short int mark[13][17];
short int next_row,next_col,row,col,dir,found=FALSE;
int i,j;
offsets move[8]; //8방향 이동에 대한 배열//
stack position=NULL;
stack w_ptr;
FILE* fp;
fp=fopen("maze.txt","r");
if(fp==NULL)
{
printf("\n\tError!! opening file 'maze.txt'!!");
exit(-1);
}
move[0].vert =-1;
move[0].horiz = 0;
move[1].vert =-1;
move[1].horiz = 1;
move[2].vert = 0;
move[2].horiz = 1;
move[3].vert = 1;
move[3].horiz = 1;
move[4].vert = 1;
move[4].horiz = 0;
move[5].vert = 1;
move[5].horiz =-1;
move[6].vert = 0;
move[6].horiz =-1;
move[7].vert =-1;
move[7].horiz =-1;
참고 자료
없음
압축파일 내 파일목록
stack.h
maze.txt
maze.cpp
stack.cpp