C++矩阵类重载运算符.docVIP

  • 15
  • 0
  • 约3.53千字
  • 约 7页
  • 2017-12-17 发布于河南
  • 举报
C矩阵类重载运算符

C++数据与结构第三次作业 潘隆武机械工程 题目:在已建立N*M的矩阵类前提下,重载运算符“+”、“*”、“=”、“”、“”。 #includeiostream #includeiomanip using namespace std; class Matrix { public: Matrix();//默认构造函数 Matrix(int ,int );//初始化构造函数 Matrix(const Matrix );//拷贝构造函数 ~Matrix();//析构函数 Matrix operator+(Matrix ); Matrix operator*(Matrix ); Matrix operator=(Matrix ); friend istream operator(istream ,Matrix ); friend ostream operator(ostream ,Matrix ); private: int row; int column; double **pt; }; //主函数 int main() { system(COLOR 0e); int r,c; Matrix temp1,temp2; cout请输入矩阵M1的行数(N)和列数(M):endl; cinrc; Matrix M1(r,c);

文档评论(0)

1亿VIP精品文档

相关文档