Home > Back-end >  A contest questions, seek to reassure (Java)
A contest questions, seek to reassure (Java)

Time:09-26

The original answer address
https://blog.csdn.net/youyuge34/article/details/52434290 what is the meaning of the value of C1.?
this why use a Switch?

CodePudding user response:

ASCII conversion, the Switch is to calculate the last value (each loop c1 is reset to zero, the last one molecule has not been calculated)

CodePudding user response:

reference 1st floor ITjavaman response:
ASCII conversion, the Switch is to calculate the last value (c1 is reset to zero each cycle, the last one molecule has not been calculated)

?? , thanks for the elder brothers:)

CodePudding user response:

Branch statement has two categories: the if expression (1)... Else if (2) expression... Else if n (expression)... Eles, and the switch (expression) {case... },
The if... else... Need to determine for many times, and multiple judgment is sequential, usually slower, but it can be applicable to expression cannot return to determine the value of,
Switch (expression) to a calculation expression usually calculated according to the value of the expression to determine the branch, the branch to a judgment in calculation, so the speed is faster, but its use is conditional,
So when to use a switch statement?
When the switch (expression) is to determine the value of the expression of results, we can use the switch statement (expression), and then walk according to the "expression" calculations in different case, while your program in C [n] is clearly a character encoding, it must be a certain value, so you can use a switch statement,

CodePudding user response:

The first code and the second code should be different program fragment, the first code should be made the translation of a String to an int
  • Related