matrix
A C++ class representing square matrices with a dynamically
allocated array.
The program creates a square matrix with a user-defined dimension
and demonstrates:
- dynamic memory management,
- a copy constructor,
- assignment with the overloaded = operator,
- input/output operators,
- overloaded arithmetic operators (+, -, * [multiplication of a
matrix by an integer]) for matrix operations.
The program also handles invalid input by assigning a default value
and demonstrates automatic memory deallocation in the destructor.
Sample input:
4 11 22 33 44 55 66 77 88 99 0 -1 -2 -3 -4 -5 -6 0 0 0 0 1 2 3 4 -1
-2 -3 -4 0 11 22 33 -1
try it on PC
The interactive compiler is available on the desktop version of this page. On a PC, you can run the program and test it directly in the console.
