@markzzz you're assigning the same row multiple times. Either assign to the elements of the matrix directly (as in here) or dynamically allocate the rows (e.g. with
new[]
) for the matrix before populating it. Seriously though, give std::vector
or std::array
a try unless this is only for didactic purposes.