#include   <windows.h> const   int   n=6;   
void   check(int   a[n][n],int   i,int   j)//i,j下标       

if(i> =0   &&   i+1 <n   &&   j> =0   &&   j+1 <n   &&   a[i][j]   ==   0) 

cout < <i < <"," < <j < <endl; 
a[i][j]   =   -1; 
check(a,i+1,j); 
check(a,i-1,j); 
check(a,i,j+1); 
check(a,i,j-1); 

}       
int   initmap()       
{       
int   a[n][n]={{0,0,1,1,1},   //0是路,1是障碍物     
            {1,0,0,0,1},       
          {0,1,0,1,1},       
          {0,0,0,0,1},       
          {1,1,1,0,0}};               
check(a,0,0); 
return   0;       
    } 
路径如何用动画显示出来 
GG能不能帮帮忙啊 
 
   
 
zhurui2001113 
 
等 级:
 发表于:2007-12-01 16:05:532楼 得分:0 
#include   <windows.h> 
#include   <stdio.h> 
#include   <list> 
using   namespace   std; 
int   b[6][6]   =   {0}; 
void   check(int   a[6][6],int   i,int   j)//i,j下标       

if(i> =0   &&   i+1 <6   &&   j> =0   &&   j+1 <6   &&   a[i][j]   ==   0) 

a[i][j]   =   -1; 
check(a,i+1,j); 
check(a,i-1,j); 
check(a,i,j+1); 
check(a,i,j-1); 

}       void   drawmap(HWND   hwnd,HDC   hdc) 

RECT   rect; 
GetClientRect(hwnd,   &rect); 
int   x   =   0; 
int   y   =   0; for(int   j=0;j <=5;++j) 

MoveToEx(hdc,x+50*j,y,NULL); 
LineTo(hdc,x+50*j,y+250); 

for(int   j=0;j <=5;++j) 

MoveToEx(hdc,x,y+50*j,NULL); 
LineTo(hdc,x+250,y+50*j); 
} RECT   rct; 
HBRUSH   hbrush   =   CreateSolidBrush(RGB(0,0,0)); 
int   a[6][6]={{0,0,1,1,1},   //0是路,1是障碍物     
  {1,0,0,0,1},       
  {0,1,0,1,1},       
  {0,0,0,0,1},       
  {1,1,1,0,0}}; 
check(a,0,0); 
for   (int   i=0;i <6;++i) 

for(int   j=0;j <6;++j) 

if(a[i][j]   ==   1) 

rct.left   =   x+50*j; 
rct.top   =   y+50*i; 
rct.right   =   x+50*(j+1); 
rct.bottom   =   y+50*(i+1); 
FillRect(hdc,&rct,hbrush); 



DeleteObject(hbrush); 
} LRESULT   CALLBACK   WinSunProc(HWND   hwnd,UINT   uMsg,   WPARAM   wParam,LPARAM   lParam);//申明函数 
HWND   hwnd; 
int   WINAPI   WinMain(HINSTANCE   hInstance,   HINSTANCE   hPrevInstance,   LPSTR   lpCmdLine,int   nCmdShow   )                     

WNDCLASS   wndcls;//窗口类实例 
wndcls.cbClsExtra=0; 
wndcls.cbWndExtra=0; 
wndcls.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH); 
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS); 
wndcls.hIcon=(HICON)LoadImage(hInstance,"game.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE); 
wndcls.hInstance=hInstance; 
wndcls.lpfnWndProc=WinSunProc; 
wndcls.lpszClassName="Jerry2007"; 
wndcls.lpszMenuName=NULL; 
wndcls.style=CS_HREDRAW   ¦   CS_VREDRAW   ¦   CS_DBLCLKS; if(!RegisterClass(&wndcls)) 

MessageBox(NULL,TEXT("This   is   error!"),"Jerry2007",MB_ICONWARNING); 
return   0; 
} hwnd=CreateWindow("Jerry2007","晨风之安魂曲",WS_OVERLAPPEDWINDOW,0,0,260,280,NULL,NULL,hInstance,NULL); if(!hwnd) 
return   false; ShowWindow(hwnd,SW_SHOWNORMAL); 
UpdateWindow(hwnd); MSG   msg;//消息实例 
while(GetMessage(&msg,NULL,0,0)) 

TranslateMessage(&msg); 
                                    DispatchMessage(&msg); 
                  } 
return   0; 
} LRESULT   CALLBACK   WinSunProc(HWND   hwnd,UINT   uMsg,WPARAM   wParam,LPARAM   lParam) 

PAINTSTRUCT   ps; 
HDC   hdc; 
RECT   rect; 
HBRUSH   hbrush_path; 
static   bool   begindrawpath   =   false; switch(uMsg) 

case   WM_CREATE: 
SetTimer(hwnd,   1,   1000,   NULL)   ; 
break; case   WM_COMMAND: break; 
case   WM_TIMER: 
                              break;                 
        case   WM_LBUTTONDOWN:                     //   左键单击动画开始 
break; 
case   WM_PAINT: 
hdc   =   BeginPaint(hwnd,&ps);   
drawmap(hwnd,   hdc); 
EndPaint(hwnd,&ps); break; 
case   WM_CLOSE: 
if(IDYES==MessageBox(hwnd,"是否真的结束?","Jerry",MB_YESNO)) 
{       
DestroyWindow(hwnd);   
}       
break;       
case     WM_DESTROY:   
PostQuitMessage(0); break; 
default: 
return   DefWindowProc(hwnd,uMsg,wParam,lParam); 

return   0; 

动画显示路径。动画那块怎么做啊各位GG,迷宫我已经绘出,就是动画显示路径,教教我啊,谢谢了。