您的位置首页生活百科

求c语言游戏编程源代码~~

问题补充说明:跪求c语言源代码,不是小游戏也行,图书馆系统什么的,自动取款机什么的也行,谢谢拉~~~~

求c语言游戏编程源代码~~

#include<iostream.来自h>

intgrid[14][17]={

{1,1,1,360问答1,1,1,1,1,1,1盾,1,1,1,1,1,1,1},

{0,0,1,0,0甚织表某善树括观,0,1,1,0,0,0,1,1,1,1,1,1},

{1,1,0,0,错拿消0,1,1,0,1,1,1,0,0,1,1,1,1},

{1,0,1,1皮飞资零,0,0,0,0,1,1,1,1,0,0,1,1,1},

{1,1,1,0,1,1,1,1,0,1,1,管且西言0,1,1,0,0,1},

{1,1,1,0,1,0,0,1,0,1,1,1,1,1,1,1,1},

{1,0,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1},

{1,0,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1},

{1,0,1,1,1,1,0,0,1,1,1,1,跳植货1,1,1,1,1},

{1,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1},

{1上春附说烧重娘究,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1},

{1,0,0,1,1,1,1,师1,0,0,0,1,1,1,1,0,1},

{1,0,1,0,0,1,1,1,1,1,0,1,1,1,1,0,0},

{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,烧真茶执编1,1}

};

voiddeal(intx,inty)

{

if(grid[x-1][y+1]>grid[x][y]+1||g社食谓差rid[x-1][y+1]==-1)

{

gr去扩id[x-1][y+1]=grid[x][y]+1;

deal(x-1,y+1);

}

if(grid[x][y+1力阶铁班土铁]>grid[x][y]+1||grid[x][y+1]==-1)

{

grid[x][y+1]=grid[x][y]+1;

deal(x,y+1);

}

if(grid季志红练我机[x+1][y+1]>grid[x][y]+1||grid[x+1][y+1]==-1)

{

grid[x+1][y+1]=grid[x][y]+1;

deal(x+1,y+1);

}

if(grid[x+杨青德种黄是永迫候1][y]>grid[x][y]+1||grid[x+1][y]==-1)

{

grid[x+1][y]=grid[x][y]+1;

deal(x+1,y);

}

if(grid[x+1]临功材难空工才计[y-1]>grid[x][y]+1||grid[x置那也究三皮两+1][y-1]==-1)

{

grid[x+1][y-1]=grid[x][y]+1;

deal(x+1,y-1);

}

if(grid[x][y-1]>grid[x][y]+1||grid[x][y-1]==-1)

{

grid[x][y-1]=grid[x][y]+1;

deal(x,y-1);

}

if(grid[x-1][y-1]>grid[x][y]+1||grid[x-1][y-1]==-1)

{

grid[x-1][y-1]=grid[x][y]+1;

deal(x-1,y-1);

}

if(grid[x-1][y]>grid[x][y]+1||grid[x-1][y]==-1)

{

grid[x-1][y]=grid[x][y]+1;

deal(x-1,y);

}

return;

}

voidmain()

{

//intx1,x2,y1,y2;

inti,j;

for(i=0;i<14;i++)

for(j=0;j<17;j++)

{

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

grid[i][j]=0;

else

grid[i][j]=-1;

}

grid[1][0]=1;

deal(1,0);

grid[1][0]=1;

for(i=0;i<14;i++)

{

for(j=0;j<17;j++)

{

cout<<grid[i][j]<<"";

}

cout<<endl;

}

}

这是我的求迷宫问题的作业不知道行不