(Topic III) 02-2 and program design process - selection structure

--- Processing switch selection structure multibranched structure

flow chart

format

Note: When the statement is any statement after the implementation of a branch, directly behind the implementation of the switch statement

The entire switch statement is finished, that the whole process will only execute a group of statements

Expressions such as plastic, string expressions; real value of the expression is not listed, can not appear in the switch statement

The result is a plurality of braces

Program input

At this time, when the input 2 is performed

Even after that there is not a program executed ....

Output results:

 

 program

If the input 4 the third case statement is executed, the output 333

 

If the input 8, case statements are not 8, otherwise the branch will be executed, output 444

 

Find function can achieve it with string

Return position behind the first letter of a word string length

If the function value is greater than 0, the beginning of the vowel output

Otherwise, the output begin with consonants

num2cell (num1: num2) function is converted into a numerical matrix cell matrix, because the colon is a value resulting expression vector

So these must first be converted to a numeric vector unit data before you can enumerate

 

Guess you like

Origin www.cnblogs.com/fanglijiao/p/11106078.html