求大牛啊求大牛

鱼头汤哟 2013-03-31 11:07:14
就是用void second(const char chest[3][3],int & row,int & col)这个函数写个3子棋的客场,帮我看看怎么完善。。。

void second(const char chest[3][3],int & row,int & col)
{
if(chest[0][0]=='*')
{
row=1;
col=1;
}
if(chest[0][1]=='*')
{
row=1;
col=1;
}
if(chest[0][2]=='*')
{
row=1;
col=1;
}
if(chest[1][0]=='*')
{
row=1;
col=1;
}
if(chest[1][1]=='*')
{
row=0;
col=0;
}
if(chest[1][2]=='*')
{
row=1;
col=1;
}
if(chest[2][0]=='*')
{
row=1;
col=1;
}
if(chest[2][1]=='*')
{
row=1;
col=1;
}
if(chest[2][2]=='*')
{
row=1;
col=1;
}
if(chest[0][1]=='*')
{
row=0;
col=2;
}
if(chest[0][2]=='*')
{
row=2;
col=2;
}
if(chest[1][0]=='*')
{
row=0;
col=2;
}
if(chest[1][2]=='*')
{
row=0:
col=2;
}
if(chest[2][0]=='*')
{
row=0;
col=2;
}
if(chest[2][1]=='*')
{
row=0;
col=2;
}
if(chest[2][2]=='*')
{
row=0;
col=2;
}
if(chest[1][0]=='*')
{
row=2;
col=0;
}
if(chest[1][2]=='*')
{
row=2;
col=0;
}
if(chest[2][0]=='*')
{
row=2;
col=2;
}
if(chest[2][1]=='*')
{
row=2;
col=0;
}
if(chest[2][2]=='*')
{
row=2;
col=0;
}
if(chest[1][2]=='*')
{
row=2;
col=2;
}
if(chest[2][1]=='*')
{
row=2;
row=2;
}
if(chest[2][2]=='*')
{
row=2;
col=0;
}
...全文
99 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
图灵狗 2013-04-01
  • 打赏
  • 举报
回复
根本不需要写函数,直接用数组建立对应表即可。

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧