0

Moving elements from an array to another based on different criterias

I'm quite new to c++, I'm a first year student.So for example I have an array with the elements 1 2 3 4 5 6 7 8 9 and I want to move in another array the numbers which are even or odd.(1 3 5 7 9 or 2 4 6 8). Or for example if one numbers divides with a number that I write to move that number in another array. I hope it's understandable what I wrote here. I appreciate the help.

26th Nov 2016, 11:56 AM
Hipnotic C
Hipnotic C - avatar
1 Respuesta
0
something like this: for ( int x=0; x < len (array); x++) { if (array[x] % y == 0) { move item; } } will check to see if items in an array are divisible by some number "y" and move them if they are
26th Nov 2016, 7:18 PM
Jay Welborn
Jay Welborn - avatar