矩阵类的设计,用C++,要求:定义矩阵类,包含行、列和矩阵数据元素;
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/05 22:35:52
矩阵类的设计,用C++,要求:定义矩阵类,包含行、列和矩阵数据元素;
最好是用到构造函数,重载函数等等,一定要有说明.很着急,明天交!1
要求至少设计以下各功能模块:
输入矩阵
输出矩阵
矩阵的加法
矩阵的乘法 \
只有一天的时间了!
最好是用到构造函数,重载函数等等,一定要有说明.很着急,明天交!1
要求至少设计以下各功能模块:
输入矩阵
输出矩阵
矩阵的加法
矩阵的乘法 \
只有一天的时间了!
我没有重载函数,只重载了运算符,你看看行不行.
这是头文件:
#ifndef MATRIX_H
#define MATRIX_H
#include
using std::cout;
using std::endl;
class Matrix{
public:
Matrix():row(0),column(0),m(0){}
Matrix(const Matrix& ma);
Matrix();
void setMatrix(int r,int c,double **ma);
int getRow(){return row;}
int getColumn(){return column;}
void display();
Matrix& operator=(const Matrix& ma);
Matrix operator+(const Matrix& ma)const;
Matrix operator-(const Matrix& ma)const;
Matrix operator*(const Matrix& ma)const;
private:
int row;
int column;
double** m;
};
Matrix::Matrix(const Matrix &ma){
this->row=ma.row;
this->column=ma.column;
m=new double *[row];
for(int i=0;i
这是头文件:
#ifndef MATRIX_H
#define MATRIX_H
#include
using std::cout;
using std::endl;
class Matrix{
public:
Matrix():row(0),column(0),m(0){}
Matrix(const Matrix& ma);
Matrix();
void setMatrix(int r,int c,double **ma);
int getRow(){return row;}
int getColumn(){return column;}
void display();
Matrix& operator=(const Matrix& ma);
Matrix operator+(const Matrix& ma)const;
Matrix operator-(const Matrix& ma)const;
Matrix operator*(const Matrix& ma)const;
private:
int row;
int column;
double** m;
};
Matrix::Matrix(const Matrix &ma){
this->row=ma.row;
this->column=ma.column;
m=new double *[row];
for(int i=0;i
矩阵类的设计,用C++,要求:定义矩阵类,包含行、列和矩阵数据元素;
矩阵类的设计定义矩阵类,包含行、列和矩阵数据元素;要求至少设计以下各功能模块: 输入矩阵
c++写一个矩阵类写一个矩阵类,矩阵类的参数包含矩阵的行、列和矩阵数据元素,其中矩阵行、列是整型,矩阵数据元素是浮点型,
写一个矩阵类 急写一个矩阵类,并能求矩阵的迹,要求该矩阵的元素用动态数据表示,按矩阵的样式在输入和输出流上进行重载.
C++中输入矩阵的行和列,A矩阵元素是行+列,B矩阵元素是行-列,输出A矩阵B矩阵.C矩阵为A乘以B.输出C矩阵
C语言输入一个3行5列的矩阵数据,输出矩阵中每行最大值
1.用java 编写一个矩阵类Matrix,要求能利用该矩阵类生成任意行、列的矩阵对象,比如3╳5矩阵10╳20矩阵
用C语言求两个矩阵相应元素之和(矩阵行和列数使用符合常量).
定义3个指向含有4 个元素的一位整形数组的指针变量,用其求A矩阵与B矩阵的和矩阵C
用C语言求7阶矩阵的行列式,求代码…… (矩阵定义在数组a[7][7]中)a[i][j]表示矩阵第i+1行,j+1列元素
为什么要将第一个矩阵每列*第二个矩阵每行数据相乘的和为新生成的矩阵上的一个元素值?
设计程序,利用循环和函数,输入一个10行10列的矩阵,并要求打印出它的内容.(1)设计Input函数输入矩阵