This additional assignment implements a simple mathematical matrix class in C++. It demonstrates basic matrix operations and OOP concepts, suitable for practice in object-oriented programming.
- Initialize matrix with custom rows and columns
- Store data in a 2D vector (
std::vector<std::vector<int>>
) - Transpose the matrix
- Populate matrix with random integers
- Access elements using subscript operators
- Retrieve number of rows and columns
- Calculate the trace of the matrix (sum of diagonal elements)
- Support matrix addition, subtraction, multiplication, and scalar multiplication through operator overloading
- Output matrix in a human-readable format
- C++
- Standard Template Library (STL)
- Object-Oriented Programming (OOP) principles
-
Clone the repository.
-
Create a build directory and navigate into it:
mkdir build
cd build
- Run CMake to generate the build files:
cmake ..
- Build the project:
cmake --build .
- Run the executable:
./main