文件名称:matrix
介绍说明--下载内容均来自于网络,请自行研究使用
3、 矩阵(三)
编写C++程序完成以下功能:
(1) 用类来实现矩阵,定义一个矩阵的类,属性包括:
矩阵大小,用 lines, rows(行、列来表示);
存贮矩阵的数组指针,根据矩阵大小动态申请(new)。
(2) 矩阵类的方法包括:
构造函数,参数是矩阵大小,需要动态申请存贮矩阵的数组;
析构函数,需要释放矩阵的数组指针;
拷贝构造函数,需要申请和复制数组;
输入,可以从cin中输入矩阵元素;
输出,将矩阵格式化输出到cout;
矩阵相加的函数,实现两个矩阵相加的功能,结果保存在另一个矩阵类,但必须矩阵大小相同;
矩阵相减的函数,实现两个矩阵相减的功能,结果保存在另一个矩阵类,但必须矩阵大小相同。
(3) 定义三个矩阵:A1、A2、A3;
(4) 初始化A1、A2;
(5) 计算并输出A3 = A1加A2,A3=A1减A2;
(6) 用new动态创建三个矩阵类的对象:pA1、pA1、pA3;
(7) 初始化pA1、pA2;
(8) 计算并输出pA3=pA1加pA2,pA3=pA1减pA2;
(9) 释放pA1、pA1、pA3。-3, matrix, (c)
Write a C++ program to perform the following functions:
(1) matrix class, define a matrix of class attributes include:
matrix size, lines, rows (rows and columns to represent)
storage matrix array pointer, dynamic application (new) according to the size of the matrix.
(2) matrix class method comprising:
constructor parameter is the size of the matrix, dynamic application memory matrix array
destructor release matrix array pointer
copy constructor, and the need to apply for and copy an array
The input from cin input matrix elements
output, the the matrix formatted output to cout
Function matrix sum, the sum of two matrices, and the results are stored in another matrix class, but must be the same as the size of the matrix
matrix function subtraction, subtract two matrices, and save the results in another matrix class, but it must be the same as the size of the matrix.
(3) d
编写C++程序完成以下功能:
(1) 用类来实现矩阵,定义一个矩阵的类,属性包括:
矩阵大小,用 lines, rows(行、列来表示);
存贮矩阵的数组指针,根据矩阵大小动态申请(new)。
(2) 矩阵类的方法包括:
构造函数,参数是矩阵大小,需要动态申请存贮矩阵的数组;
析构函数,需要释放矩阵的数组指针;
拷贝构造函数,需要申请和复制数组;
输入,可以从cin中输入矩阵元素;
输出,将矩阵格式化输出到cout;
矩阵相加的函数,实现两个矩阵相加的功能,结果保存在另一个矩阵类,但必须矩阵大小相同;
矩阵相减的函数,实现两个矩阵相减的功能,结果保存在另一个矩阵类,但必须矩阵大小相同。
(3) 定义三个矩阵:A1、A2、A3;
(4) 初始化A1、A2;
(5) 计算并输出A3 = A1加A2,A3=A1减A2;
(6) 用new动态创建三个矩阵类的对象:pA1、pA1、pA3;
(7) 初始化pA1、pA2;
(8) 计算并输出pA3=pA1加pA2,pA3=pA1减pA2;
(9) 释放pA1、pA1、pA3。-3, matrix, (c)
Write a C++ program to perform the following functions:
(1) matrix class, define a matrix of class attributes include:
matrix size, lines, rows (rows and columns to represent)
storage matrix array pointer, dynamic application (new) according to the size of the matrix.
(2) matrix class method comprising:
constructor parameter is the size of the matrix, dynamic application memory matrix array
destructor release matrix array pointer
copy constructor, and the need to apply for and copy an array
The input from cin input matrix elements
output, the the matrix formatted output to cout
Function matrix sum, the sum of two matrices, and the results are stored in another matrix class, but must be the same as the size of the matrix
matrix function subtraction, subtract two matrices, and save the results in another matrix class, but it must be the same as the size of the matrix.
(3) d
(系统自动生成,下载前可以参看下载内容)
下载文件列表
matrix.cpp