Hello guys... how to return odd and even numbers in 5x5 array and put the odd number in array and even numbers in another array using func
This is the array
int n[5][5] = { { 1,2,3,4,5}
,{6,7,8,9,10}
,{11,12, 13,14,15}
,{16,17,18,19,20}
,{21,22,23,24,25} };
@Dani, you are very inconsistent.
You have just written (to @Jonnin):
can you give me the code please?
and (to @Thomas1965):
I don't want you to write a code to me
I note:
I'm an engineer student
Then I sincerely hope that in both this thread and your other current one you will be able to:
(a) express your problem more clearly;
(b) make an effort to provide some initial start code of your own.
Did you know that "engineer" came from the same root as "ingenuity"?
goodness. Ill do it but you get what you get with me lol. I take the direct approach and don't believe in 2d arrays. Do show some effort going forward, though. Most of us work in the industry. Most of us have had to deal with new hires that cheated their way thru school. Most of those people did not keep their jobs long.
1 2 3 4 5 6 7 8
vector<int> o;
vector<int> e;
int *ip = n[0]; //convert 2d mess array to 1d
for(int i = 0; i< 25; i++) //iterate over 1d version
if(ip[i]%2 ==0)
e.push_back(ip[i]) //load the even vector
else
o.push_back(ip[i]) //load the odd vector