is it possible to compare value in switch statement?
i.e: a > b
is it possible??
You really shouldn't need to, the comparison operators return a bool value so an if else should be enough.
but is it possible to compare in switch statement?
No, I don't believe that a switch statement will evaluate 'bool'. I'll be honest, I didn't verify this but it shouldn't work.
|but is it possible to compare in switch statement? |
int a = 0, b = 1;
switch(a > b)
std::cout << a << std::endl << b << std::endl;
I guess that would to do it, I thought the OP meant for each 'case' statement to be a separate evaluation.
Topic archived. No new replies allowed.