The 2DMatrix.cpp program implements a sparse matrix data structure using a custom class called SparseRow. The class stores a matrix row’s details including the row number, column number, and value. The program includes constructors, getter and setter methods, and an overloaded stream insertion operator to display the contents.
- Representation of a sparse matrix row.
- Constructors: default and parameterized.
- Getter and setter functions for row, column, and value.
- A display function and an overloaded
<<operator for easy output.
- C++ compiler supporting C++11 or later (e.g., g++ or clang++).
To compile the program, run: bash g++ -std=c++11 -o 2DMatrix 2DMatrix.cpp