I am a beginner in c++, I am trying to write a program that read 7 integers like x, a, b, c, d, e, f.
The program is to count how many of the following condition are true:
x is in [a, b]
x is in [c, d]
x is in [e, f]
so the program will return either 1, 2, 3. my program :
I used to variable a and b to get input for the three pair intervals.
sample input : 7 1 10 5 6 4 40
expected output: 2
The program final result will give 2, but when I uncomment line 12 (print the value of the a and b before increment cnt ) the final result will be 3.
I don't know why I am getting different result. Does printing have effect of the code below?
I haven't seen this kind of thing in Python3 (know well). This question might seem silly for you but I am very confused why this is happening?
Thanks in Advance!