weixin_34472988 于 2016.04.09 20:03 提问

2个回答

Gentle_Guan   2016.04.09 20:32

#include

using namespace std;

int s[10001][10001],Map[10001][10001]= {0};
int main()
{
int m,n,i,j,k,l;
cout<<"请输入二位数组的行m,列n的值："< cin>>m>>n;
cout<<"请输入二位数组中01信息："< for (i=1; i {
for (j=1; j {
cin>>s[i][j];
}
}
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
{
if (s[i][j]==1&&Map[i][j]!=1)
{
for (k=1; k<=n; k++)
{
s[i][k]=1;
Map[i][k]=1;
}
for(l=1; l<=m; l++)
{
s[l][j]=1;
Map[l][j]=1;
}
}
}
}
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
{
cout<<s[i][j]<<"\t";
}
cout<<endl;
}

``````return 0;
``````

}

Gentle_Guan 回复weixin_34472988: 恩 ++

weixin_34472988 回复Gentle_Guan: 能用C语言写么？这是C++？

Gentle_Guan   2016.04.09 20:33

#include

using namespace std;

int s[10001][10001],Map[10001][10001]= {0};
int main()
{
int m,n,i,j,k,l;
cout<<"请输入二位数组的行m,列n的值："< cin>>m>>n;
cout<<"请输入二位数组中01信息："< for (i=1; i {
for (j=1; j {
cin>>s[i][j];
}
}
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
{
if (s[i][j]==1&&Map[i][j]!=1)
{
for (k=1; k<=n; k++)
{
s[i][k]=1;
Map[i][k]=1;
}
for(l=1; l<=m; l++)
{
s[l][j]=1;
Map[l][j]=1;
}
}
}
}
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
{
cout<<s[i][j]<<"\t";
}
cout<<endl;
}

``````return 0;
``````

}