//1. The function of an expression statement: Executing an expression and discarding the evaluation result intValue =Ten; Value+5;//Execute, and discard the result//2. A compound statement is a sequence of statements and declarations enclosed in curly braces, called blocks. A block is a scope. The block does not end with a semicolon. //3. Add curly braces after the if else while, etc. to help the program read. //The 4.else matches its closest unmatched if match. //in a 5.switch case statement, the case label must be an integer constant expression. //The switch statement should preferably have default, which is intended to indicate that the defaults are currently taken into account. //C + + stipulates that an initialization statement that crosses a variable is not allowed to jump directly to another location within the scope of the variable. Switch(value) { Case 0: { inti = +;//right, because I is in the block scope Break; } Case 1: intJ//correct, and no initial value specified for J//int k = 0; //error, "K" Initialization action skipped by "case" tab Break; Case 2: J=Ten; printf ("%d\n", j);//if value is 2, the output Break; Case 3: printf ("%d\n", j);//if value is 3, the output is chaotic . Break; default: Break; }//6. Do not use Goto in the program, which can cause the program to be difficult to understand.
C++primer the Fifth chapter