#2
yuccn2015-06-01 15:50
|
具体如下:
在View中声明:Matrix mmin;
Matrix头文件:
程序代码:
class Matrix
{
public:
int cols;
int rows;
int *gridData ;
Matrix();
~Matrix();
};
构造函数:
程序代码:
Matrix::Matrix()
{
this->rows = 15;
this->cols = 10;
gridData = new int[rows*cols];
for (int i = 0; i <= rows; i++)
{
for (int j = 0; j <= cols; j++)
{
gridData[i*cols + j] = 0;
}
}
}
{
this->rows = 15;
this->cols = 10;
gridData = new int[rows*cols];
for (int i = 0; i <= rows; i++)
{
for (int j = 0; j <= cols; j++)
{
gridData[i*cols + j] = 0;
}
}
}
求大牛帮帮忙!