不打印正确的元素

时间:2012-04-23 18:02:12

标签: c++

我将一个对象传递给我的函数...并访问存储在该对象的双数组中的每个元素......

我可以在监视窗口看到元素在那里(60.5),它只是打印旧值(1006)。???

double MatrixClass::min(MatrixClass* matOb)
        {
            double tempNum = matOb->dataptr[0 * matOb->N + 0];//set the value of tempNum to the first element of the matrix object

            for(int i =0;i<((matOb->M) * (matOb->N));i++)
            {
                //double value = *matOb->dataptr + i;
                //cout << (*matOb->dataptr+i);
                if((*matOb->dataptr + i) < tempNum)
                {
                    tempNum = (*matOb->dataptr + i);
                }//end if
            }
            return tempNum;
        }//end min

你可以在上面看到我的功能...即使打印该值也会给出旧值(1006)..我可以确定值60.5在那里,它只是在我更改它之前打印旧值! / p>

0 个答案:

没有答案
相关问题