Hello everyone i need help in making 10x10 array in which it all containts 0 then i would have to put 1 in random elements in it then when finished, the program should count how many objects are found. which means that how many 1's are in a form of six. examples are
111111
or
1111
11
or
11
11
11
and such.. Thankyou for your help! it will be really appreciated. Sorry i'm very noob at programming.
the inputting goes through horizontally. Actually, we can put any number but only those with 1 will be recognized as long as it is in a groups of six for example:
would give me 3 objects. Sorry but i havent done anything so far because we don't exactly have an idea on how to make an arrays because we were just on looping then he brought this up.
The most important thing to remember with arrays is that the index starts at 0, not 1. So if you declare an array of 10 elements, you access them with indexes 0-9, not 1-10.
To define a 10x10 array of integers: int myarray[10][10];
One way to access it is like this:
1 2 3 4 5 6
for (int i=0; i<10; ++i) {
for (int j=0; j<10; ++j) {
cout << myarray[i][j];
}
cout << '\n';
}