I would like to know how to compare int values.
I would like to know that once I compare both 2 int values, I would like to know how far apart these 2 values are and if it is possible to put this in a ‘if’ statement.
The only problem I have is that (lets say int HELLO), HELLO’s value always changes at random, so I would like to know how do I always compare HELLO’s value and a different int’s value on the go, so that at any moment if the result of both values are only 50 numbers off (negative or positive), it would trigger let’s say timer2->Stop();.
Thank you.
If you have two int values, then you can subtract them to find out the difference between the two. Then in your if-test you just check if they are within 50 of each other and then execute the code…
Here’s some pseudocode for you to work off of:
You could then make that as a function and pass your values in (as you’ve stated they’re different each time).