Looking for numbers within a certain range eg 1 - 10

Hi guys

Does anybody know how to tell a c++ program to look for a number between 1-10 in an array.

e.g

if ( i == 1- 10)

I know that would not work but just so you get the idea.

Thanks :)
if you want to look for a number in a range you could do it as followed

if(i > 0 && i < 11)

or if this is clearer

if(i >= 1 && i <= 10)

However, if you want to search in an array you will have to use a loop to go through each element in the array and check the condition
Thank you Pascale :)

It is for an array, ive already got the loop, just could not rememmber how to check the range

Thanks alot .
Topic archived. No new replies allowed.