1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| class SparseMatrix { private: int Rows, Cols, Terms; Triple *smArray; public: SparseMatrix(int Rw, int Cl, int Tm); void Transpose(SparseMatrix &b); }; SparseMatrix::SparseMatrix(int Rw, int Cl, int Tm) { Rows = Rw; Cols = Cl; Terms = Tm; smArray = new Triple[Terms]; if (smArray == NULL) { cout << “存储分配失败!” << endl; exit(1); } };
|