为了避免在嵌套的条件语句if...else中产生歧义,C++规定的if...else语句的匹配原则是()。

A:else子句与所排位置相同的if配对 B:else子句与其之前最近的if配对 C:else子句与其之后最近的if配对 D:else子句与同一行上的if配对

A tourist (can) find (cheap) computers nowhere (else) in the world than (in) Hong Kong.( )

A:can B:cheap C:else D:in

A significant (proportions) of the plants and animals (of) Hawaii exists (nowhere else) in (the world).

A:proportions B:of C:nowhere else D:the world

It was (him) who did all the work (on) the invention, but somebody (else) got (all the credit).

A:him B:on C:else D:all the credit

为了避免在嵌套的条件语句if-else中产生二义性,C语言中规定的if-else配对原则是______。

A:else子句与缩排位置相同的if配对 B:else子句与其之前最近的未被配对的if配对 C:else子句与其之后最近的if配对 D:else子句与同一行上的if配对

以下选项中,正确的if-else语句是 ( )

A:if(x!=0)
printf("%d",x)
else
printf("%d",-x);
B:if(x!=0)
x=x+y;printf("%d",x);
else
printf("%d",-x);
C:if(x!=0)
x=x+y;printf("%d",x);
else
printf("%d",-x);
D:if(x!=0)
x=x+y;printf("%d",x);
else
printf("%d",-x);

为了避免在嵌套的条件语句if-else中产生二义性,C语言中规定的if-else配对原则是______。

A:else子句与缩排位置相同的if配对 B:else子句与其之前最近的未被配对的if配对 C:else子句与其之后最近的if配对 D:else子句与同一行上的if配对

以下选项中,正确的if-else语句是 ( )

A:if(x!=0) printf("%d", else printf("%d",-; B:if(x!=0) { x=x+y;printf("%d",;} else printf("%d",-; C:if(x!=0) x=x+y;printf("%d",; else printf("%d",-; D:if(x!=0) { x=x+y;printf("%d",}; else printf("%d",-;

微信扫码获取答案解析
下载APP查看答案解析