appending extra column to existing matrix

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]

iteration 3: [ 1 0 0 0
0 -1 0 0
0 0 0 0 ] - append a extra column

[ 1 0 0 0
0 -1 0 0
0 0 0 0
0 0 0 0] - append extra row

check if type is (A/B/C) and place (-1/1/0) at (4,4) accordingly.
[ 1 0 0 0
0 -1 0 0
0 0 0 0​
0 0 0 1]
What are you using to store the matrix?
a double value.

In a matrix i wanted to store presence of different elements.
I think you misunderstand. A double holds a single value. What are you using to store the matrix of doubles?
Topic archived. No new replies allowed.