Getting wrong message for function

Oct 30, 2013 at 4:49am

if (a <= 800 && a >= 200){
ansa = true;
}
Last edited on Oct 30, 2013 at 5:46am
Oct 30, 2013 at 5:03am
I suspect that the issue here is the number of parenthesis that you included. Try encompassing the <= and >= comparisons with parenthesis themselves and see if that makes a difference. By <= and >= comparisons, I mean rewrite (a <= 800 && a >= 200) to ((a <= 800) && (a >= 200))
Last edited on Oct 30, 2013 at 5:03am
Oct 30, 2013 at 5:09am
Still says it's valid even though it shouldn't be.
1
2
3
4
5
6
7
8
Enter 1000 for the first value to end this program
Enter First Score: -30
Enter Second Score: 40
Enter Third Score: 50
-30 is invalid
40 is invalid
50 is invalid
this group is valid
Oct 30, 2013 at 8:16am
A single line of code may not be enough to figure out the problem. I think you need to show the complete code so we can see the way it will behave.
Topic archived. No new replies allowed.