I\'m trying to write a code that has a lot of comparison
Write a program in “QUANT.C” which “quantifies” numbers. Read an integer “x” and test it, pro
Why do you have a preference to use switch?
I'm asking because this sounds awfully like a 'homework question'. A compiler should deal with if/else construct just as efficiently as a switch (even if you weren't dealing with ranges).
Switch can't handle ranges as you have shown, but you could find a way to include switch by categorising the input first (using if/else) then using a switch statement to output the answer.