g++ foo.cpp -W{all,extra,pedantic}
foo.cpp: In function ‘int main()’:
foo.cpp:215:39: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses]
else if(5 < con1 <= 8){
foo.cpp:219:39: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses]
else if(2 < con1 <= 5){
foo.cpp:235:39: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses]
else if(5 < con2 <= 8){
foo.cpp:239:39: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses]
else if(2 < con2 <= 5){
the condition evaluates to true and then you have an out of bound access in the body of the conditional