#include<iostream>
using namespace std;
int main()
{
int col_,row_;
cout<<" 输入二维数组的行列"<<endl;
cin>>row_>>col_;
int size_,n;
int *array= new int[n=size_=row_*col_];
int value;
row_=col_=0;
while(n>0)
{
cin>>value;
if(value==1)
{
array[size_*row_+col_]=value;
if(++col_==size_)
++row_,col_=0;
--n;
}
}
delete [] array;
return 0;
}
using namespace std;
int main()
{
int col_,row_;
cout<<" 输入二维数组的行列"<<endl;
cin>>row_>>col_;
int size_,n;
int *array= new int[n=size_=row_*col_];
int value;
row_=col_=0;
while(n>0)
{
cin>>value;
if(value==1)
{
array[size_*row_+col_]=value;
if(++col_==size_)
++row_,col_=0;
--n;
}
}
delete [] array;
return 0;
}
樱花大战, 有爱.