To start school (ah ah ah ah ah ah ah ah ah ah ah oh ah ah)
Be a silent action! (Peeing, peeing, peeing) today, I found a lot of basics on the water problem.
1. Switch (Control statement)
{Case constant expression: {statement;} break;
Case constant expression: {statement;} break;
。
。
Default:{statement;} Break
}
2. Precautions;
(1) switch control type int in C #, Char also has NULL
(2) The case must be a unique constant expression (if it needs to be computed with an IF)
(3) Note the position of the curly braces
(4) Break
#include <cstdio>#include<iostream>#include<cstring>using namespacestd;Const intn= +;CharSs[n];intMain () { while(gets (ss)) { for(intI=strlen (SS)-1; i>=0; i--) { Switch(Ss[i]) { Case'1': Case '2': {printf ("0000\n");p rintf ("111222\n");} Break; Case '3': printf ("333333\n"); Break; }} printf ("\ n"); } return 0;}
C # switch