matrix
can some1 tell me the source code for this matrix:
1 0 0
0 1 0
0 0 1
For example
1 2 3 4
|
const int N = 3;
int a[N][N] = { { true, false, false },
{ false, true, false },
{ false, false, true } };
|
Or
1 2 3 4
|
const int N = 3;
int a[N][N] = {};
for ( int i = 0; i < N; i++ ) a[i][i] = 1;
|
It is not clear what code you are awaiting.
Last edited on
1 2 3 4 5
|
int matrix[3][3] = {
{1, 0, 0},
{0, 1, 0},
{0, 0, 1}
};
|
i thought (if (j=i) aij=1 else aij=0) if u understand what i mean cuz im a beginner and i just started learning c++
Topic archived. No new replies allowed.