These are some numbers and I have 20 boxes. (Numbers are provided by the user. So I have a " std::cin << " at the beginning of the code.)
I would like to do something like this:
1 2 3 4 5 6 7 8 9
if ( number > -2. && number < -1.8 ) box1 = true;
if ( number > = -1.8 && number < -1.6 ) box2 = true;
if ( number >= -1.6 && number < -1.4 ) box3 = true;
if ( number >= -0.4 && number < -0.2) ...
.....
if ( number >= 0 && number < 0.2) ...
.....
.....
if (number >= 1.8 && number < 2.0 ) box20 = true;
The range is between (-2.0 , 2.0) .
at the end of the code, I will print the boxes information whether it's true or not... What is the simplest way to do this ?
I have already a similar thread here but this was is long (and also advanced) for me. http://www.cplusplus.com/forum/general/49226/ . I believe, there should be a much simpler way to do this, instead of writing a class.