连个回复的都没有!!!失望
看看我的代码吧!
#include
using namespace std;
void Display();
int a[16] = {1,2,3,4,5,6,0,8,9,10,7,11,13,14,15,12};
void main()
{
Display();
int j = 0;
for(int i = 0; i < 3; i++)
{
while(a[j] != 0)
{
j++;
}
a[j] = a[j-1] + 1;
int num = a[j];
while(a[++j] != num)
;
a[j] = 0;
Display();
}
char ch;
cin >> ch;
}
void Display()
{
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
if(a[i*4+j] == 0)
{
cout << ” ” << ‘\t’;
}
else
{
cout << a[i*4+j] << ‘\t’;
}
}
cout << endl;
}
cout << endl;
}