Hello,
I was given a question a few few days back to write a program that lets a user enter a value for an angle and quadrant in which the angle lies is printed using switch statement.
I was able to make this program using if-else very easily but making it with switch statement is a problem..
I tried using
switch (angle)
{
case (angle>=0 && angle<=90):
printf("1st quadrant");
break;
.
.
.
.
}
and so on....(where angle is the variable in which the value of angle is stored )
it gives me the error "Case constant required in statement switch"...
it works if I write it like case 90:,case 45: and all other constant values..
but,i can't go writing all 360 cases for all angles,can I???
So,is there any way to check a condition in switch statement??
---
Thanks in advance..