单选题 若定义:float x;int a,b;,则正确的switch语句是( )。
A.switch(x)

case1.0:cout<<"*/n";
case2.0:cout<<"**/n";

B.switch(x)
case 1.2:cout<<"*/n";
case 3:cout<<"**/n";

C.switch(a+b)

case 1.0:cout<<"*/n";
case 1+2:cout<<"**/n";

D.switch(a+b)

case 1:cout<<"*/n";
case 2:cout<<"**/n";


【正确答案】 D
【答案解析】