Hi i'm new here ,and i'm still rookie at working with C++ Builder 6

I have a task ,which i don't understand. My task is like that :..
Number array E (m,n) and i need to
replace all the line and column even(oddly) numbers to 0(zero).

Please im praying you all to show me how the exact formula looks like.

p.s.
example of formula which is replacing first line of array to 0

``````void TForm1::Change()
{
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (A[i][j] % 2 == 0)
A[i][j] = 0;
}``````

but still i dont think i need this one :) waiting for your replies.

but still i dont think i need this one

Then you're wrong. Looks like the 'perfect' function for a 2d-array.

yes i know this formula is ok ,but i need to modify it to the function which will replace all the line and column even(oddly) numbers to 0(zero), how i said before :(
sry if my english pritty bad

nileshgr

I didn't understand your problem. You want to replace numbers with zero if the number is even or something else ?

Example :
we have array
4 3 (4 lines) (3 colums)
1 2 3
5 8 4
2 9 7
6 5 1
and i need a formula , to replace even numbers to 0 in array.
it is need to be like this ,i show in a same exampled array.
4 3 (4 lines) (3 colums)
1 0 3
5 0 0
0 9 7
0 5 1

I hope u get my mind :)

nileshgr

Here's the code -

``````#include <iostream>

using namespace std;

int main() {

int numArr[][3] = {  {1,2,3},
{5,8,4},
{2,9,7},
{6,5,1} };

for ( int i = 0; i < 4; i++ ) {

for ( int j = 0; j < 3; j++ ) {

if (numArr[i][j] % 2 == 0) {

numArr[i][j] = 0;

}

cout << numArr[i][j];

}

cout << endl;

}

}``````

So you want to consider only the even row and column. The see if that
even row or column is a even number, if so set it to 0 else do nothing?

thx itech7 i will try to attach it to my array :)