作业帮 > 综合 > 作业

请帮我翻一下这段英语The swi tch statement is used in Listing 5.4 inste

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/15 18:32:00
请帮我翻一下这段英语
The swi tch statement is used in Listing 5.4 instead of a chain of i f statements.The
panel's getMouseAction method returns an integer.If this integer matches one of the named constants following the case label,then the statements following that constant are executed until a b r e a k statement is encountered.If a c a s e does not include a b r e a k,then the execution continues with the next case.The equivalent of the el se construct in an if statement is def aul t followed by statements that are executed if none of the explicit cases occur.
表5.4使用了switch语句而不是一系列if语句.面板的getMouseAction方法返回一个整数.如果这个整数和某一个case标签后面的所指明的常数匹配,那么这个匹配常数之后的语句都将被执行直到遇到一个break语句.如果一个case标签内的程序不包含break语句,那么程序在执行完这个case标签内的语句后将接着执行下一个case标签内的语句.等价于if语句中的else结构的是default标签,default内的语句将被执行,如果没有任何一个case标签被匹配执行.
整编在解释switch结构/语句的用法,随便找本中文C语言编程的书,查switch的用法,对照就明白了.