C++矩阵错误class Demo{public:\x05Demo();\x05~Demo();\x05double **allocMatrix(int n);\x05void releaseMatrix(double **m);private:\x05double **Matrix;};double Demo::**allocMatrix(int n){\x05cin >> n;\x05\x05for (int i = 0; i Matrix[i][j];//这里会

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/02 09:58:56
C++矩阵错误class Demo{public:\x05Demo();\x05~Demo();\x05double **allocMatrix(int n);\x05void releaseMatrix(double **m);private:\x05double **Matrix;};double Demo::**allocMatrix(int n){\x05cin >> n;\x05\x05for (int i = 0; i Matrix[i][j];//这里会
xR_KP*1u0+zqk/}aiHRfXd0MR0"{uߢfEý; a.ol.WFݮ$zXQ)q瘙 aQUuiALք7ue*I%gʦcc\y."Ih9k (@ ʑ-+eeG}p _~^>4nޞHρA(2{2}iEj#w%qG7R

C++矩阵错误class Demo{public:\x05Demo();\x05~Demo();\x05double **allocMatrix(int n);\x05void releaseMatrix(double **m);private:\x05double **Matrix;};double Demo::**allocMatrix(int n){\x05cin >> n;\x05\x05for (int i = 0; i Matrix[i][j];//这里会
C++矩阵错误
class Demo
{
public:
\x05Demo();
\x05~Demo();
\x05double **allocMatrix(int n);
\x05void releaseMatrix(double **m);
private:
\x05double **Matrix;
};
double Demo::**allocMatrix(int n)
{
\x05cin >> n;
\x05
\x05for (int i = 0; i Matrix[i][j];//这里会报错,
\x05\x05\x05cout

C++矩阵错误class Demo{public:\x05Demo();\x05~Demo();\x05double **allocMatrix(int n);\x05void releaseMatrix(double **m);private:\x05double **Matrix;};double Demo::**allocMatrix(int n){\x05cin >> n;\x05\x05for (int i = 0; i Matrix[i][j];//这里会
1) Matrix是一个成员变量,你不需要在allocMatrix中返回,也不需要在releaseMatrix中输入,这是基本的OO概念
2) n是allocMatrix的参数,没有道理再输入一次,你需要把cin>>n删除
3) Matrix在使用之前没有分配内存