#include <stdio.h>
void main(void)
{
int price;
scanf("%d", &price);
switch (price)
{
case 1000: // what i want - case pay >= 1000
// code (no break - intentional)
case 500: // ....... - case pay >= 500
// code
default:
break;
}
}
I'm new to this. Is there any alternative to switch without break and also able to use comparisons, not constant, in a switch?
Just series of if statements then :
if (price >= 1000) {
// do something
}
if (price >= 500) {
// do some more stuff
}
You may also want to use #define for those magic numbers (1000, 500 ...). Or Enumerate them using enum.
Although switch() looks like a function, it's a statement block.
As others have said, this problem is better suited to consecutive if blocks than to a switch statement (where the use of deliberate fall-through is frowned-upon by many in the C programming world).
However, if you want to divide a number into ranges of fixed-size blocks (in your case, that size is 500), then you can divide your number by that block-size and use the result as the switch variable. Also, note that the default case doesn't have to be the final case – it can be anywhere, even first.
In the below example, because of the fall-through (i.e. no break; statements in any of the case blocks), the case 0: code will be run for any input; for inputs less than 500 (i.e. the integer division will result in 0), only that case will execute. For numbers in the range 500 thru 999 (division will give 1), the case 1 and case 0 code will run; and, for numbers >= 1000, the default case will run, followed by the other two blocks. (This code requires a positive value for price!)
#include <stdio.h>
int main(void)
{
int price = 0;
printf("Price: ");
int s = scanf("%d", &price);
if (s != 1 || price < 0) {
printf("Invalid price!\n");
}
else {
switch (price / 500) {
default:
printf("Price is >= 1000!\n");
case 1:
printf("Price is >= 500\n");
case 0:
printf("Price is anything\n");
}
}
return 0;
}
As I have said, I would generally not recommend using a switch in cases (poor pun) like this; but, that advice notwithstanding, it is then actually quite easy to add extra blocks/conditions, such as code for prices in the 1000 - 1499 range, where you could just insert a case 2: block to the code. Furthermore, when the number of 'ranges' becomes sufficiently large (say, more than 3), then it does arguably become clearer to use such a switch, rather than a chain of if statements/blocks.
Note: For added clarity – if your compiler supports it (clang and gcc do but I'm not aware of an equivalent for MSVC) – then you can add __attribute__((fallthrough)); statements wherever you are relying on any (implied) fall-though from one case block to the next. In the code shown above, such statements would be added immediately before the case 1: and case 0: labels.
Use chained if … else statements:
if (1000 <= price)
{
// Things for price 1000 or more.
}
else if (500 <= price)
{
// Things for price 500 or more.
}
else
{
// Things for other cases.
}
Related
I'm doing a final project right now and I have the following code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int main(void){
int day;
int year;
int month;
int daynum=0;
int days=365;
printf("\nPlease input what year you would like to meet\n");
scanf("%d",&year);
printf("\nPlease input what month you would like to meet\n");
scanf("%d",&month);
printf("\nPlease input what day you would like to meet\n");
scanf("%d",&day);
//Later in the code i have the following loop
int k=month;
do {
k--;
switch (k) {
case 0:
case 2:
case 4:
case 6:
case 7:
case 9:
case 11:
daynum=daynum+31;
printf("\nadded 31");
break;
case 1:
if (days==365) {
daynum=daynum+28;
}
else if (days==366) {
daynum=daynum+29;
}
printf("\nadded 28/29");
break;
case 3:
case 5:
case 8:
case 10:
daynum=daynum+30;
printf("\nadded 30");
break;
default:
printf("\nsomething went wrong");
}
}while(k>=0);
return 0;
}
I've tried essentially the same thing with a while and for loop but every time the only thing that shows up in the console is something went wrong. I even tried checking the value of k before the loop and it says it is equal to month. I've also tried setting k equal to a number and it works just fine with that, but i need it to equal month. I really have no idea whats wrong and any help would be appreciated.
The problem is that you're decrementing k at the beginning of the loop body, but checking it at the end of the loop. So on the last iteration you'll decrement it to -1, print the error message, and then stop the loop.
Change the condition to while(k > 0).
Well, I believe you now know the error as #Barmar wrote.
Anyway I add:
always, I mean always, check for the return of scanf(): there is no point in letting the program go if some of the values are not read. scanf() always returns the number of specifiers read, that things that starts with a single %. In your case it will be 1, 0 or -1.
about this
do {
k--;
switch (k) {
you can always switch(--k) with the same effect.
you could state the purpose of the code and provide at least one test value. If you are trying to get the number of days up to and including the user supplied one, you could have made it clear. I was just guessing.
note that Excel or Google sheets can operate on dates so it is a good free reliable check point.
a small change on the default label, like
printf("\n==> daynum is %d, k is %d and something went wrong\n", daynum, k);
would have print
==> daynum is 365, k is -1 and something went wrong
and it would be very helpful. Far better than just write something went wrong. make your program work for you.
you do not need a switch to compute always the same values. Use a table. And as the only change in days is in February just add the extra day there as we always do...
char days_in_month[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
days_in_month[1] += ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0; // 1 or 0
use the command line for the arguments. It is a bit boring enter the program name and then 3 parameters in 3 lines just to see a resulting number.
Honestly have no idea what was the issue with my code, but i moved this section of code further up and its working as intended now. Somewhere months was getting reset to 0 before the loop despite this being the first time i referenced it besides in printf statements. thank you to #dbush who helped me find out the issue.
There's this exercise I'm trying to figure out. The assignment asks to convert a two-digit number in words, the output should be something like this :
Enter a two-digit number:45
You entered the number forty-five.
I'm still a total beginner to programming. I'm at this chapter in this C programming book, in the exercise section about the switch and if statements. The exercise suggests to use two switch statements, One for the tens and the other one for units, but numbers within 11 and 19 require special treatment.
The problem is that I'm trying to figure out what should I do for numbers between 11 and 19, I was thinking to use the if statement but then the second switch function would include in the output and it would turn into something like You've entered the number eleven one.
This is the program I've been writing so far (incomplete):
int digits;
printf("Enter a two-digit number:");
scanf("%d", &digits);
printf("You entered the number ");
switch (digits / 10) {
case 20:
printf("twenty-");break;
case 30:
printf("thirty-");break;
case 40:
printf("forty-");break;
case 50:
printf("fifty-");break;
case 60:
printf("sixty-");break;
case 70:
printf("seventy-");break;
case 80:
printf("eighty-");break;
case 90:
printf("ninety-");break;
}
switch (digits % 10) {
case 1:
printf("one.");break;
case 2:
printf("two.");break;
case 3:
printf("three.");break;
case 4:
printf("four.");break;
case 5:
printf("five."); break;
case 6:
printf("six.");break;
case 7:
printf("seven.");break;
case 8:
printf("eight.");break;
case 9:
printf("nine.");break;
}
return 0;
Before the switch use these if then else statements.
if (digits == 11) {
printf("eleven");
}
else if (digits == 12) {
printf("twelve");
}
else if (... ) {// similar statements for 13 14 15 16 17 18 19
}
// now figure out where do the switch statements have to be inserted
else {
// here?
}
// or here?
The above solution assumes you haven't learnt arrays yet. If you have learnt or know to use arrays - there are ways to improve this code.
This is such a good problem for a learner, do not want to give much away
// Pseudo code
int print_two_digits(int tens, int ones) {
if (tens 2 or more)
print tens_place(tens) // use `tens` to index an array of strings.
if (ones == 0) return;
print -
else
ones += tens*10;
print ones_text(ones) // ones is 0-19 at this point. Index an string array with `ones`
}
How to index a string array and print?
// index: valid for 0,1,2
void print rgb(int index) {
const char *primary[] = { "red", "green", "blue" };
puts(primary[index]);
}
Trivia: English numbers in text 10-99 are mostly big-endian, most significant first as in "forty-two", except for [11-19] which has the smaller digit first as in "fourteen".
I would suggest you write a function with 3 switches instead of 2:
a first switch to handle special cases such as 0 and the numbers from 10 to 19 and return directly.
a second switch to handle tens from 20 and print the word without a trailing dash,
an if statement where you test if you need a dash,
a third switch where you handle units.
In the equation :
What is the fastest way in C language to find x with a given power of two value (a) ?
Edit :
The mathematical exact solution is :
As (a) is a positive integer and a power of two (no rational number, no equal to zero), this problem can be simplified as "looking for position of set bit".
This post is focused on lite embedded CPU systems. For example : ARM CORTEX M4.
a to x results :
a | x
-------
1 | 0
2 | 1
4 | 2
8 | 3
16 | 4
32 | 5
64 | 6
128 | 7
256 | 8
512 | 9
...
Option 1 : The dirty loop
unsigned int get_power_of_two_exponent(unsigned int value)
{
unsigned int x = 0;
while( ( 1 << x ) != value)
{
x ++;
}
return x;
}
Option 2 : The weird trick
#include <stdint.h>
#if defined(__GNUC__)
static int highest_bit_set(uint32_t value)
{
if (sizeof (unsigned int) == sizeof value)
return 31 - __builtin_clz(value);
else
if (sizeof (unsigned long) == sizeof value)
return 31 - __builtin_clzl(value);
else
exit(127); /* Weird architecture! */
}
#endif
Any faster options ?
Fastest in C is almost always look-up tables, at the expense of memory use. Assuming that the value is always exactly a power of 2, you can make a look-up table like this:
uint8_t get_exponent (uint8_t val)
{
static const uint8_t byte[256] =
{
[1] = 0,
[2] = 1,
[4] = 2,
[8] = 3,
[16] = 4,
[32] = 5,
[64] = 6,
[128] = 7,
};
return byte[val & 0xFF];
}
It will return 0 in case you pass a value which isn't a power of 2.
This can be expanded further either by looping through for example the 4 bytes of a uint32_t and do 4 table-lookups. Or by making even bigger look-up tables.
On x86 I get the above to boil down to this tiny, branch-free machine code:
get_exponent:
movzx edi, dil
movzx eax, BYTE PTR byte.2173[rdi]
ret
(Swapping to uint_fast8_t gives identical code in this case.)
This answer is in dispute - see comment.
The fastest way, somewhat facetiously1, is to write
switch (a)
{
case 1: return 0;
case 2: return 1;
case 4: return 2;
...
Clearly there are as many labels as there are bits in the type, but this is still O(1).
You could even truncate a to a power of two using the idiom a ^ (a & (a - 1)), at the expense of portability given that only works if a is a 2's complement type.
1Although in C++ you could get the compiler to build the table with constexpr and metaprogramming techniques.
The best performances (on my embedded ARM CORTEX M4 CPU core) are obtained with :
Builtin CLZ solution (Count Leading Zero’s)
Moreover, the CLZ solution is by far much more memory efficient than the lookup table method which take the second place.
Often, the LookUp table method still less efficient than the Builtin CLZ because the table is stored in RAM like a DDR for example. Thus, it can takes a dozen of cycle to access the data in this kind of RAM. In this example, this is amplified by the fact that the instruction cache is enabled but not the data cache. Besides, having this huge table stored in cache would not have been very appropriate.
It depends how big values you would like to search, and if there's the biggest possible input defined.
If x can be, for example, 100, searching from beginning (x = 0) with step x++, isn't elegant and optimized (100 checks). You can set step x+=5. If the result is lower than searched value, x+=5. If bigger - step back with x-- (max 4 Times). Size of step you can adjust to your needs.
If there's a "top-limit", you can create an array of possible x and implement binary search.
#Lundin's answer seems the best in terms of speed (just 3 assembly instructions!), but it may not be a good option for your embedded system. If huge LUTs are not an option:
The weird trick seems to be the a fast option, I guess (you should benchmark each option and see actual results, though). You could use that one in case it exists, and fallback to the usual shifting otherwise:
#include <stdint.h>
static int get_pow2_exp(uint32_t value)
{
#if defined(__GNUC__)
if (sizeof(unsigned int) == sizeof(value))
return 31 - __builtin_clz(value);
if (sizeof(unsigned long) == sizeof(value))
return 31 - __builtin_clzl(value);
#endif
int x;
for (x = -1; value; value >>= 1)
x++;
return x;
}
If you want to ensure that it is a power of two, you may use popcnt. Your while loop is an infinite loop in case the input is not a power of two, while mine just gives a solution based on the highest bit (which may be incorrect, depending on your needs).
2^x = a is the equation
Assuming 32 bit architecture and 'a' & 'x' as integers.
Here is my approach
uint32_t x;
uint8_t *ptr ;
uint8_t ByteNo,BitNo,i;
void My_Function(uint32_t a)
{
ByteNo = BitNo = 9;//some random number
ptr = (uint8_t*)&a;//Assuming points to LSB in variable a
for(i=0;i<4;i++)
{
switch(*ptr)
{
case 0x01: BitNo=0;break;
case 0x02: BitNo=1;break;
case 0x04: BitNo=2;break;
case 0x08: BitNo=3;break;
case 0x10: BitNo=4;break;
case 0x20: BitNo=5;break;
case 0x40: BitNo=6;break;
case 0x80: BitNo=7;break;
case 0x00: BitNo=9;break;
default : break;//take care error condition
}
if(9 != BitNo)
{
break;
}
else
{
ptr++;
}
}//for loop
ByteNo = i;
x = (BitNo) + (ByteNo*8);
}//My_Function
Another approach:
switch(a)
{
case 0x00000001: x=0; break;
case 0x00000002: x=1; break;
case 0x00000004: x=2; break;
case 0x00000008: x=3; break;
case 0x00000010: x=4; break;
case 0x00000020: x=5; break;
case 0x00000040: x=6; break;
case 0x00000080: x=7; break;
case 0x00000100: x=8; break;
case 0x00000200: x=9; break;
case 0x00000400: x=10; break;
case 0x00000800: x=11; break;
case 0x00001000: x=12; break;
case 0x00002000: x=13; break;
case 0x00004000: x=14; break;
case 0x00008000: x=15; break;
case 0x00010000: x=16; break;
case 0x00020000: x=17; break;
case 0x00040000: x=18; break;
case 0x00080000: x=19; break;
case 0x00100000: x=20; break;
case 0x00200000: x=21; break;
case 0x00400000: x=22; break;
case 0x00800000: x=23; break;
case 0x01000000: x=24; break;
case 0x02000000: x=25; break;
case 0x04000000: x=26; break;
case 0x08000000: x=27; break;
case 0x10000000: x=28; break;
case 0x20000000: x=29; break;
case 0x40000000: x=30; break;
case 0x80000000: x=31; break;
default: break;//error condition
}
My logic is:
if number is between 1 to 10, execute first case statement
if number is from 20 to 30, execute second case statement
is there a solution other than the one below?
case '1' ... '10':
case '20' ... '30':
The GCC compiler supports, as a language extension, case ranges like:
switch(i) {
case 0 ... 9: return true;
default: return false;
}
This language extension is also accepted by Clang/LLVM. So use it if you can afford restricting your code to GCC & Clang compilers.
See also this.
I have no idea why this extension was not included in C11 standard.
Notice also that GCC accepts computed or indirect goto and labels as values. There are cases (in particular in
generated C code) where these features are useful. Examples could include some efficient bytecode interpreter. Some implementations of the Ocaml virtual machine are a good example.
void SwitchDemo(int value)
{
switch(value / 10)
{
case 0: ...; break; // 0 - 9
case 1: ...; break; // 10 - 19
...
}
}
or, specific to the question ranges:
void SwitchDemo(int value)
{
switch((value-1) / 10)
{
case 0: ...; break; // 1 - 10
case 1: ...; break; // 11 - 20
...
}
}
Option 1: use case 0 for 0-9, case 1 for 11-20 and so on.
Option 2: use if
Option 3:
Another shabby way is using fall through cases like this:
#include <stdio.h>
int main(void) {
int i=1;
for(i=1;i<=25;i++)
{
switch(i)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
printf("%d is in between 1-10\n", i);
break;
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
printf("%d is in between 11-20\n", i);
break;
default:
printf("%d is above 20\n", i);
}
}
return 0;
}
Output:
1 is in between 1-10
2 is in between 1-10
3 is in between 1-10
4 is in between 1-10
5 is in between 1-10
6 is in between 1-10
7 is in between 1-10
8 is in between 1-10
9 is in between 1-10
10 is in between 1-10
11 is in between 11-20
12 is in between 11-20
13 is in between 11-20
14 is in between 11-20
15 is in between 11-20
16 is in between 11-20
17 is in between 11-20
18 is in between 11-20
19 is in between 11-20
20 is in between 11-20
21 is above 20
22 is above 20
23 is above 20
24 is above 20
25 is above 20
https://ideone.com/Cw6HDO
C doesn't support case values other than single integers (or integer-like things -- characters, enumeration values). So your options are:
As suggested by pzaenger in a now-deleted comment: transform the number you're working with into something you can switch on (in this case, divide by 10).
Multiple case statements (taking advantage of fallthrough): case 1: case 2: case 3: ... case 10: do_something();
Use if rather than case.
In the C programming language the case statement used in a switch() statement must specify a value that the compiler can turn into a constant in some way. Each of the values used in the case statements must be unique within the scope of the switch(). The default keyword indicates the default if none of the case statements match the expression in the switch() statement.
As an aside, check out Duff's Device to show an interesting use of switch() and case. See How does Duff's device work?
So the following shows several examples of proper case statements in a switch():
#define XXVAL 2
#define CASETEST(x) (x + 5)
int iValue;
// set the value of the variable iValue at some point
switch (iValue) {
case 0:
// do the case if iValue == 0
break;
case XXVAL:
// do the case if iValue == XXVAL
break;
case CASETEST(3):
// do the case if iValue == CASETEST(3)
// works because preprocessor generates the source text which is
// then compiled and the expression can be resolved to a constant
break;
case CASETEST(5) * 2:
// do the case if iValue == CASETEST(5) * 2
// works because preprocessor generates the source text which is
// then compiled and the expression can be resolved to a constant
break;
default:
break;
}
What you can do if you still want to use a switch() with ranged case statements is to provide some mechanism to fold the expression into one or more specific constant values.
So in a simple, trivial example you could do something like the following. This is a trivial case to show the technique which ends up making the logic of the simple if statements opaque. This technique can be useful for complex decisions and classification that can be folded into a simple set of constants.
int foldit (int iValue)
{
if (iValue < 5000) return 0;
else if (iValue < 10000) return 1;
else if (ivalue < 20000) return 2;
else return 9999; // triggers the default part of the switch
}
switch (foldit(iValue)) {
case 0:
// do what is needed for up to but not including 5000
break;
case 1:
// do what is needed for 5000 up to but not including 10000
break;
case 2:
// do what is needed for 10000 up to but not including 20000
break;
default:
// handle anything else
break;
}
Where the fold approach can be helpful is when you have several different results perhaps using a filter to try to classify a data item.
#define type1 0x00001
#define type2 0x00002
#define type3 0x00004
#define type4 0x00008
struct datatype {
int iVal;
int jVal;
};
unsigned long is_a_type1(struct datatype * thing)
{
unsigned long retVal = 0; // initialize to not a type1, set to type1 if turns out to be
// do checks for the type and if so set retVal to type1 if it matches
return retVal;
}
unsigned long is_a_type2(struct datatype * thing)
{
unsigned long retVal = 0; // initialize to not a type2, set to type2 if turns out to be
// do checks for the type and if so set retVal to type2 if it matches
return retVal;
}
unsigned long is_a_type3(struct datatype * thing)
{
unsigned long retVal = 0; // initialize to not a type3, set to type3 if turns out to be
// do checks for the type and if so set retVal to type3 if it matches
return retVal;
}
unsigned long is_a_type4(struct datatype * thing)
{
unsigned long retVal = 0; // initialize to not a type4, set to type4 if turns out to be
// do checks for the type and if so set retVal to type4 if it matches
return retVal;
}
unsigned long classify (struct datatype *thing)
{
unsigned long ulTestResult = 0;
// test to see if this is a type1 thing
ulTestResult |= is_a_type1(thing);
// test to see if this is a type2 thing
ulTestResult |= is_a_type2(thing);
// test to see if this is a type3 thing
ulTestResult |= is_a_type3(thing);
// test to see if this is a type4 thing
ulTestResult |= is_a_type4(thing);
return ulTestResult;
}
int main ()
{
struct datatype myThing;
// other source code then
switch (classify(&myThing)) {
case type1 | type2 | type3:
// do stuff if this is a type1, type2, and type3 but not type4
// that is classify() determined that myThing matched all three types.
break;
case type1:
// do stuff if type1 which includes stuff you do for type2 as well under
// special values of myThing.
if (myThing.iVal < 50) {
case type2:
// at this point we have type2 case stuff that we do. Code above is skipped
// and the switch () will jump straight to here if classify() is type2.
//
// Also stuff we do if type1 and myThing.iVal < 50
// in other words this code is execute if classify(&myThing) is type2 or
// if classify(&myThink) is type1 and there is a special processing for myThing.iVal < 50
break; // if classify() type2 or if classify() type1 and myThing.ival < 50
}
// do stuff if only type1 and myThing.iVal >= 50
break;
case type2 | type3:
// do stuff if type2 and type3 matched but none of the others.
break;
default:
// any other case
break;
}
return 0;
}
Switch statements in c can only operate on a constant expression, the case statements cannot include dynamic comparisons.
Example of something which is, and is not, a "Constant Expression" in C?
For something this simple an if/else structure could be clearer and simpler, depending on the compiler your case statement may be translated into a series of branching comparison statements anyways.
I am aware of various switch case opimization techniques, but as per my understanding most of the modern compilers do not care about how you write switch cases, they optimize them anyway.
Here is the issue:
void func( int num)
set = 1,2,3,4,6,7,8,10,11,15
{
if (num is not from set )
regular_action();
else
unusual_stuff();
}
The set would always have values mentioned above or something resembling with many of the elements closely spaced.
E.g.
set = 0,2,3,6,7,8,11,15,27 is another possible value.
The passed no is not from this set most of the times during my program run, but when it is from the set I need to take some actions.
I have tried to simulate the above behavior with following functions just to figure out which way the switch statement should be written. Below functions do not do anything except the switch case - jump tables - comparisons.
I need to determine whether compare_1 is faster or compare_2 is faster. On my dual core machine, compare_2 always looks faster but I am unable to figure out why does this happen? Is the compiler so smart that it optimizes in such cases too?
There is no way of feeling that one function is faster than the other. Do measurements (without the printf) and also compare the assembler that is produced (use the option -S to the compiler).
Here are some suggestions for optimizing a switch statement:
Remove the switch statement
Redesign your code so that a switch statement is not necessary. For example, implementing virtual base methods in a base class. Or using an array.
Filter out common choices. If there are many choices in a range, reduce the choices to the first item in the range (although the compiler may do this automagically for you.)
Keep choices contiguous
This is very easy for the compiler to implement as a single indexed jump table.
Many choices, not contiguous
One method is to implement an associated array (key, function pointer). The code may search the table or for larger tables, they could be implemented as a linked list. Other options are possible.
Few choices, not contiguous
Often implemented by compilers as an if-elseif ladder.
Profiling
The real proof is in setting compiler optimization switches and profiling.
The Assembly Listing
You may want to code up some switch statements and see how the compiler generates the assembly code. See which version generates the optimal assembly code for your situation.
If your set really consists of numbers in the range 0 to 63, use:
#define SET 0x.......ULL
if (num < 64U && (1ULL<<num & SET)) foo();
else bar();
Looking at your comparison functions, the second one is always faster because it is optimized to always execute the default statement. The default statement is execute "in order" as it appears in the switch, so in the second function it is immediately executed. It is very efficiently giving you the same answer for every switch!
Default case must always appear as the last case in a switch. See http://www.tutorialspoint.com/cplusplus/cpp_switch_statement.htm
for example, where it states "A switch statement can have an optional default case, which must appear at the end of the switch. The default case can be used for performing a task when none of the cases is true. No break is needed in the default case."
Here are the functions mentioned above
#define MAX 100000000
void compare_1(void)
{
unsigned long i;
unsigned long j;
printf("%s\n", __FUNCTION__);
for(i=0;i<MAX;i++)
{
j = rand()%100;
switch(j)
{
case 1:
case 2:
case 3:
case 4:
case 6:
case 7:
case 8:
case 10:
case 11:
case 15:
break ;
default:
break ;
}
}
}
void unreg(void)
{
int i;
int j;
printf("%s\n", __FUNCTION__);
for(i=0;i<MAX;i++)
{
j = rand()%100;
switch(j)
{
default:
break ;
case 1:
case 2:
case 3:
case 4:
case 6:
case 7:
case 8:
case 10:
case 11:
case 15:
break ;
}
}
}