if(a>b){max=a;}else{max=b;}等价于
A: max=(a>b)?a:b
B: max=(a>b):a?b
C: (a>b)?a:b
D: (a>b):a?b
A: max=(a>b)?a:b
B: max=(a>b):a?b
C: (a>b)?a:b
D: (a>b):a?b
举一反三
- 下面程序的运行结果是: int a=3,b=2,max; if (a>b) max=a; else max=b; printf("max=%d",max); A: max=%d B: max=3 C: 3 D: max=2
- 请阅读以下程序,并选择最终max的值:var a=10,b=13.5,c=11,max;if(a >; b){ if(a >; c){max = a;}else{max = c;}}else{if(b >; c){max = b;}else{max = c;}} A: 10 B: 12 C: 11 D: 13.5
- C语句max=(a>b)?a:b;和a>b?max=a:max=b;是等价的。
- 将以下程序写成三目运算表达式语句是:if (a>b) max=a;else max=b; A: max=(a>b)?; B: (max=a>b)?a:b; C: c=(a>b)?a:b; D: max=(a>b)?a:b;
- if(a>b)max=a; elsemax=b; 的等价语句为 max=(a>b)?a:b;