Closed and Open Intervals

Hello Hello !
Haw should I write with "for" this:
Closed and Open invervals:

-> (a,b)

-> [a,b]

-> (a,b]

-> (b,a]

Note 1: a, b --> are int numbers-wherever.


And if is possible:
> [a,b)

> [b,a)

Note 2: //I know this is possible with infinite limits, but this is possible with int numbers ?




I am looking more,folks, if you can help me,least with the ones from UP.

Wish you best !
Last edited on
See: https://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals

1
2
3
4
5
6
7
for( auto i = a+1 ; i < b ; ++i ) { /* ... */ } // (a,b)

for( auto i = a+1 ; i <= b ; ++i ) { /* ... */ } // (a,b]

for( auto i = a ; i < b ; ++i ) { /* ... */ } // [a,b)

for( auto i = a ; i <= b ; ++i ) { /* ... */ } // [a,b] 
thank you. !!!!!!!!!
Topic archived. No new replies allowed.