create matrix

dear all

In my program , result is like this :

0001000
000100
00010
0001
000
00
0

I show the this result in the bold part in following matrix
now I want to print this matrix from my program

00001000
00000100
00000010
00000001
10000000
01000000
00100000
00010000


how can I get this result ?

Thanks
Regards

Last edited on
closed account (zwA4jE8b)
A matrix is just a 2 dimensional array, create one and use a for loop for [i] nested with [j]

Thank you for your answer

Would you please give me a example code about it ? because already I test it with this way but could not get correct result :(


Regards
closed account (zwA4jE8b)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int i, j;
int arr1[8][8];

//This will allow you to input the numbers individually to fill the array.
for (i = 0; i <= 7; i++)
     for (j = 0; j < = 7; j++)
           cin >> arr1[i][j];

//This will output the array.
for (i = 0; i <= 7; i++)
     {
     for (j = 0; j < = 7; j++)
           cout << arr1[i][j];
     cout << endl;
     }


I think thats right... try it out. customize it to fit what you need.

Thank you again

I will test this part in my program

If I cannot use it , I will send message again to get help

Regards
Topic archived. No new replies allowed.