how to pick numbers from array that are less or greater then constant

Hi, here is the situation: there is an array of 100 random values, and I need to pick greater than number 50 and lesser than 50 values in two separate arrays, any suggestions? :)
Last edited on
What's the problem?
I cant do it, can you ? than please show :)
You surely can do it, you just do not want to i guess.

Just to give you an idea, you could simply create two other arrays with size 100 each and loop through the given array with random values.

http://cplusplus.com/doc/tutorial/
You see, this task is just part, after that i need to count those greater and lesser values, so if i choose to create 100-size-arrays and compiler picks e.g. 20 values that are randomly allocated in original array, that are greater then 50 then I couldnt count those 20-picked values that are allocated in new-100-size-array.
Last edited on
All you need to do for that is add two int variables, initialize them to 0 and increment them whenever you add a value to one of the two arrays. It's really not that hard, you just need to think about it.

Honestly i bet i spent more time with this problem here than you did.
Thank you, AleaIactaEst, for advice of increment.
Topic archived. No new replies allowed.