How do you put a > or < sign into a switch statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you put a > or < sign into a switch statement?

I'm trying to build a code like this but it isn't working: switch (a){ case > 95 : cout >> "bla" ; } Please help

10th May 2018, 5:35 PM
JDLives
2 Answers
+ 1
You can't. Switch statements are not If-elseif-else blocks. The way they work is that a table of values will be created by the compiler and the code will look for each value within the table. In other words, you can't do what you're trying to do.
10th May 2018, 5:41 PM
Vlad Serbu
Vlad Serbu - avatar
0
thank you
11th May 2018, 2:18 AM
JDLives