C语言错误c2063,请教C语言中关于将二维数组复制到一个三维数组的问题

ca56232b3bbedf9a539d07f37fffb99a.gif

3144d8b7615c79d9f638db40d5689d26.gif

a218af6549b45ee526caf607ebff1358.gif

0f8df0e29816ae721419de940fb833d1.gif

请教C语言中关于将二维数组复制到一个三维数组的问题

小白正在填写一段代码,是有点类似与俄罗斯方块的一段游戏代码,代码如下

要求在增加参数,变量和函数的情况下完成此代码,只能填写// write appropriate codes here.部分。在填到int possible(int m[MR][MC],int b[BR][BC],int pcl[][MR][MC],int pcn)函数部分时,不知道该怎么将二维数组的值复制到一个三维数组中,试了很多次都失败了,所以在此求助各位,帮帮小白

void print(int m[MR][MC]) // EX05

{

int r,c;

for(r=0;r

{

for (c=0;c

{

printf("%d ",m[r][c]);

}

printf("\n");

}

}

int equal(int m1[MR][MC],int m2[MR][MC]) // EX06

{

int r,c;

for (r=0;r

for (c=0;c

{

if(m1[r][c]!=m2[r][c])

return 0;

}

return 1;

}

void reset(int m[MR][MC]) // EX07

{

int r,c;

for(r=0;r

for(c=0;c

m[r][c]=0;

}

}

}

void copy(int m1[MR][MC],int m2[MR][MC]) // EX12

{

int r,c;

for(r=0;r

for(c=0;c

m1[r][c]=m2[r][c];

}

int is_overlap(int m1[MR][MC],int m2[MR][MC]) // EX17

{

int r,c;

for (r=0;r

for (c=0;c

{

if(m1[r][c]!=0 && m2[r][c]!=0)

return 1;

}

return 0;

}

int paste(int m[MR][MC],int r0,int c0,int b[BR][BC]) // EX18

{

int r,c;

for(r=0;r

for(c=0;c

if(b[r][c]==1){

if(r+r0>=0 && c+c0>=0 && r+r0

m[r+r0][c+c0]=b[r][c];

else return 0;

}

}

return 1;

}

int possible(int m[MR][MC],int b[BR][BC],int pcl[][MR][MC],int pcn)

{

int temp[MR][MC];

int r,c,i;

// write appropriate codes here.

return pcn;

}

int main(void)

{

int pcl[1000][MR][MC];

int pcn=0;

int m[MR][MC] = {

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

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

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

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

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

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

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

};

int b[BR][BC] = {

{0,0,0,0},

{1,1,1,0},

{1,0,0,0},

{0,0,0,0},

};

int i;

pcn=possible(m,b,pcl,pcn);

for(i=0;i

printf("possible choice id=%d\n",i);

print(pcl[i]);

}

return 0;

}

最后应该得到的结果如下

possible choice id=0

0 0 0 0 1 1 1

0 0 0 0 1 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=1

0 0 0 0 0 0 0

1 1 1 0 0 0 0

1 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=2

0 0 0 0 0 0 0

0 0 1 1 1 0 0

0 0 1 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=3

0 0 0 0 0 0 0

0 0 0 1 1 1 0

0 0 0 1 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=4

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 1 1 1 0 0

0 0 1 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=5

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

1 1 1 0 0 0 0

1 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=6

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 1 1 1 0 0

0 0 1 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=7

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 1 1 1 0

0 0 0 1 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

possible choice id=8

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 1 1 1 0

0 0 0 1 0 0 0

possible choice id=9

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 1 1 1

0 0 0 0 1 0 0

希望大家帮忙谢谢大家

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值