1. ## who can sent me code about 8 numbers

1 3 2 1 2 3
8 5 0 =>> 8 0 4
6 7 4 7 6 5
thanks!

2. I'm afraid you're going to have to be a lot more descriptive than that. What is it your are trying to do? With what? What have you done so far?

3. ## sorry!

I have no Intelligence about C!

4. And we don't have psychic powers... We can't help if we don't know what you're trying to do.

5. ## could you help!

I try my best to figure out !But I fail!
2 3 4
1 8 0
7 6 5

2 0 8
1 4 3
7 6 5

2 8 3
1 4 5
7 0 6

2 8 3
0 6 4
1 7 5

2 8 3
1 6 0
7 5 4

8 3 0
2 1 4
7 6 5

8 1 3
2 0 4
7 6 5

2 8 3
7 0 4
6 1 5

2 8 3
7 1 4
6 5 0

1 2 3
8 0 4
7 6 5

#include<iostream.h>
#include<stdlib.h>
#include<stdio.h>
#define Nil 0
#define LEN sizeof(struct Table)
struct Table
{
int change[3][3];
struct Table *next;
};
int ExtendOpen(struct Table *p);
int Same(int matrix1[3][3],int matrix2[3][3]);
void swap(int &a,int &b);
static int target[3][3]={{1,2,3},{8,0,4},{7,6,5}}; //目标状态
int main()
{
int source[3][3];
int i,j,flag(0);
char c;
cout<<"请输入初始状态！"<<endl; //读取初始状态
temp=(struct Table *)malloc(LEN);
for(i=0;i<3;i++)
{
cout<<"请输入第"<<(i+1)<<"行，每输入一个数字后按空 格，输入三个数字后按回车结束："<<endl;
for(j=0;j<3;j++)
cin>>source[i][j];
}
if(Same(source,target)) flag=1; //如果输入状态已是目标状态，则置flag为1
{
flag=ExtendOpen(temp); //扩展n，把它的后继结点放入OPEN表的末端，提供回到n的 指针
}
cout<<"该问题无法解决！"<<endl;
else
{
FILE *pFile;

/* Open for write */
if( (pFile = fopen( "output.txt", "w" )) == NULL )
{
printf( "The file 'output.txt' was not opened\n" );
return 0;
}
char s[100];
sprintf( s,"CLOSE表的内容:\n");
fwrite( s,strlen(s),1,pFile);
cout<<"CLOSE表的内容:"<<endl;
sprintf( s,"OPEN表的内容:\n");
fwrite( s,strlen(s),1,pFile);
cout<<"OPEN表的内容:"<<endl;
fclose(pFile);
}
cout<<"Press any key to terminate!";
cin>>c;

return 0;
}

//************************************************** **************
{
int i,j;
struct Table *p0,*p1,*p2;
p0=p1=p2=(struct Table *)malloc(LEN);
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
(p1->change)[i][j]=matrix[i][j];
}
}
(p1->next)=Nil;
}
else //如果表中已有内容，则插入到表的最后
{
while((p1->next)!=Nil)
{
p2=p1;
p1=(p2->next);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
(p0->change)[i][j]=matrix[i][j];
}
}
p1->next=p0;
p0->next=Nil;
};
}
//************************************************** **********

//************************************************** **********
{
int i,j;
struct Table *p0,*p1,*p2;
p0=p1=p2=(struct Table *)malloc(LEN);
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
}
p1->next=Nil;
}
else
{
while((p1->next)!=Nil)
{
p2=p1;
p1=p2->next;
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
}
p1->next=p0;
p0->next=Nil;
};
}
//************************************************** ************

//************************************************** ************
int ExtendOpen(struct Table *p) //扩展OPEN表
{
int temp1[3][3],temp2[3][3],temp3[3][3],temp4[3][3];
int i,j,flag(0);
int row(0),line(0);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
temp1[i][j]=(p->change)[i][j];
temp2[i][j]=(p->change)[i][j];
temp3[i][j]=(p->change)[i][j];
temp4[i][j]=(p->change)[i][j];
if((p->change)[i][j]==0)
{
row=i;
line=j;
}
}
};
if((line>0)&&(!flag))
{
swap(temp1[row][line],temp1[row][line-1]);
if(Same(temp1,target))
flag=1;
};
if((row>0)&&(!flag))
{
swap(temp2[row][line],temp2[row-1][line]);
if(Same(temp2,target))
flag=1;
};
if((line<2)&&(!flag))
{ swap(temp3[row][line],(temp3)[row][line+1]);
if(Same(temp3,target))
flag=1;
};
if((row<2)&&(!flag))
{ swap((temp4)[row][line],(temp4)[row+1][line]);
if(Same(temp4,target))
flag=1;
};
return (flag);
}
//************************************************** ****
int InTable(int matrix[3][3],struct Table *head) //判断新产生的结点是否属于CLOSE或OPEN表
{
int i,j,flag1(0),flag2(0);
struct Table *p1,*p2;
while((p1!=Nil)&&(!flag2))
{
flag1=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
if(matrix[i][j]!=(p1->change)[i][j])
flag1=1;
}
if(flag1==0) flag2=1; //后移一个检查
p2=p1;
p1=p2->next;
}
return(flag2);
}
//************************************************** ****
int Same(int matrix1[3][3],int matrix2[3][3]) //判断是否相同的矩阵
{
int i,j,flag3(1);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(matrix1[i][j]!=matrix2[i][j])
flag3=0;
}
}
return(flag3);
}

//************************************************** *
void swap(int &a,int &b)
{
int t;
t=a;a=b;b=t;
}
//************************************************** *
void output(struct Table *head,FILE *pFile) //将表中内容依次输出
{

char s[100]="";
int i,j;
struct Table *p1,*p2;
while(p1!=Nil)
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
char stemp[100];
sprintf(stemp,"%d ",(p1->change)[i][j]);
strcat(s,stemp);
cout<<(p1->change)[i][j]<<" ";
}
strcat(s,"\n");
cout<<endl;
}
strcat(s,"\n");
cout<<endl;
fwrite(s,strlen(s),1,pFile);
sprintf(s,"");
p2=p1;
p1=p2->next;
}

}

6. Can you explain in just simple English what your program should do?

7. ## Re: sorry!

Originally posted by xacoolboy
I have no Intelligence about C!
I'm sure that's not the only thing you have "no intelligence about"

8. ## thanks

2 8 3
1 0 4
7 6 5
transform
1 2 3
8 0 4
7 6 5
by C programing!

extent searching or depth searching

thanks!!