so my problem is that I'm trying to write a program that uses a switch case to tell a function which case to do. I tried to include an or statement into the switch cases so that I could have a range of values for each case but it seems to be presenting me with an error. Is there a fix to this problem using the switch case or am I simply misusing the switch case and should try a different method? Thanks.
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int Random(int);
void Movement(void);
int main()
{
int healthratio=5;
switch(healthratio){
case healthratio>0 || healthratio<=10:
printf("%d.\n",healthratio);
break;
case healthratio>10 || healthratio<=20:
printf("%d.\n",healthratio);
break;
case healthratio>20:
printf("%d.\n",healthratio);
break;
}
}
When I run this code I get this error "error: case label does not reduce to an integer constant"