|
楼主 |
发表于 2006-10-21 19:35
|
显示全部楼层
核心算法没写上,先帖了。。。
- #include <stdio.h>
- typedef struct point{
- int x;
- int y;
- int flag;
- }T_chess[9][10];
- struct pointStack{
- struct point * value;
- struct pointStack *next;
- }
- T_chess chess;
- void findDir(struct point*,struct point*);
- void printDir(struct point*);
- struct pointStack * allocStack(struct point* value);
- int main(){
- struct point start,end;
- //initial data
- for(i=0;i<9;i++){
- for(j=0;j<10;j++){
- chess[i][j].x=i;
- chess[i][j].y=j;
- chess[i][j].flag=0;
- }
- }
- scanf("%d %d %d %d",&start.x,&start.y,&end.x,&end.y);
- start.flag=1;
- end.flag=0;
- findDir(&start,&end);
- }
- void findDir(struct point *s,struct point *e)
- {
- }
- void printDir(struct pointStack *s)
- {
- struct pointStack *tmp;
- while(!s){
- printf("[%d,%d] ",(s->value).x,(s->value).y);
- tmp=s->next;
- s=tmp;
- }
- }
- struct pointStack * allocStack(struct point * value){
- struct pointStack *ret=malloc(sizof(struct pointStack));
- ret->next=null;
- ret->value=s;
- return ret;
- }
复制代码
[ 本帖最后由 iptton 于 2006-10-21 19:47 编辑 ] |
|