I need your help for appending extra column of zeros and extra row of zeros to the existing matrix.I tried using pointers and vectors.But could not achieve it.I wanted to create a matrix dynamically.
for example: i need a matrix like
1 0 0 0
0 -1 0 0
0 0 0 0
0 0 0 1
first a 1 X 1 matrix is created it checks if it is a (A/B/C)-if yes then it places a (-1/1/ 0) at (0,0)
then
iteration 1: [1]
[1 0] -append a new column
[1 0
0 0] -append a new row
check if type is (A/B/C) and place (-1/1/0) at (2,2) accordingly.
[1 0
0 -1]
iteration 2: [1 0 0
0 -1 0] -append extra column
[ 1 0 0
0 -1 0
0 0 0]- append extra row.
check if type is (A/B/C) and place (-1/1/0) at (3,3) accordingly.
[ 1 0 0
0 -1 0
0 0 0]