0
How to program if statement when the input asking is 500up and 700below(numbers) w/out boundary.
I can make an imaginary boundary (600) but is there a better way to code than that?
7 Antworten
+ 1
Use switch statement or if , else if , else statement
+ 1
If I got your point , you have to add second condition to both if and else if.
if(num>=500 && num<600)
And something similar in else if
0
But each has its own value.
Input 500up Output Math
Input 700below Output Social Science
0
So your input must be between 500 and 700?
It would be easier to understand your problem when we could see your code
0
I was tasked to do if, else if, else statement.
Right now my code looks like this:
if (num>=500){
cout<<"Math";
}
else if (num<=700) {
cout<<"Social Science";
}
........
so when I input 699 the output is always Math
0
It's frustrating when instructions are unclear/vague
0
I could do that and make a boundary (600) but i was hoping there is an alternative but i guess its the only option I have. Thank you for helping me. I'll just stick to 600 as a boundary