Here is an example. Note that in the first example the case values are the values you are screening for. Remember that I stated that they must be constants. Expressions and variables do not work. This is one reason that switches aren't always the preferred method. Statements that the switch is more efficient are usually full of crap, also. Unless the compiler chooses to emit a jump table, you will find that the emitted machine code is virtually identical.

The second example addresses your problem. Any use of a switch here is just contraindicated.

Please note that the return of scanf is tested in every instance. You are asking your user for input that must be gathered AND CONVERTED. What if it doesn't convert? Your program will run off into the weeds and barf on its shoes, that's what. There is nothing to prevent your user from entering "a b", either in error, or maliciously. The rather expert bozos that wrote the utility functions almost always give them a return value. If you don't use it, you are not (yet) competent, much less an expert. In some situations you will need to resort to other functions to determine the exact cause of an error. feof () and ferror () come to mind.
Code:
#include <stdio.h>

int utOh (char *troubleInRiverCity)
{
    fprintf (stderr, "%s\n", troubleInRiverCity);
    return -1;
}

int main(void)
{
    int menu;
    float kilo, meters;
    int q, x;

    printf ("Enter an integer: ");
    if (scanf ("%d", &q) != 1)
	return utOh ("Bad input");

    switch (q)
    {
	case 7: puts ("Congratulations, you collect\n\n");
		break;
	case 2: puts ("Woopsie, you crapped out\n\n");
		break;
	default: printf ("Your point is %d\n\n", q);
    }

    printf ("Enter weight and height: ");
    if (scanf ("%f %f", &kilo, &meters) != 2)
	return utOh ("Bad input");

    q = kilo / meters * meters;
    printf ("q is %d\n" , q);

    if (q < 20) puts ("You are underweight\n");
    else if ((q >= 20) && (q < 25)) puts ("You are at a healthy weight\n");
    else puts ("Give up the doughnuts, lardazz\n");

    puts ("Press ENTER to exit (sounds silly, I know");
    rewind (stdin);
    getchar ();

    return 0;
}
Quote:
Originally Posted by output
Enter an integer: 7
Congratulations, you collect


Enter weight and height: 1000 3
q is 111
Give up the doughnuts, lardazz

Press ENTER to exit (sounds silly, I know