📄 p53_54test.cpp
字号:
//Test is T55_59.cpp
#include <iostream.h>
const int MaxTerms = 100;
template <class Type> class SparseMatrix; //稀疏矩阵的类声明
template <class Type> class Trituple { //三元组类Trituple
friend class SparseMatrix<Type> ;
friend istream & operator >> ( istream & , SparseMatrix<Type> & );
friend ostream & operator << ( ostream & , SparseMatrix<Type> & );
private:
int row, col; //非零元素的行号、列号
Type value; //非零元素的值
};
template <class Type> class SparseMatrix {
//对象: 是一个三元组<row, column, value>的集合。其中, row和column是整数, 记忆矩阵
//元素所在的行号和列号,而value是矩阵元素的值。
friend istream & operator >> ( istream & , SparseMatrix<Type> & );
friend ostream & operator << ( ostream & , SparseMatrix<Type> & );
public:
SparseMatrix ();
SparseMatrix ( int MaxRow, int MaxCol ): Rows( MaxRow ), Cols( MaxCol ){}; //构造函数
//建立一个MaxRow行, Maxcol列的稀疏矩阵。
SparseMatrix<Type> Transpose ( );
//对*t
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -