• 2022-07-26
    若a和b均是正整型变量,正确的switch语句是( )
    A: switch(pow(a,2)+pow(b,2)) (注:pow为求幂的数学函数){case 1: case 3: y=a+b;break;case 0: case 5: y=a-b;}
    B: switch(a*a+b*b);{case 3:case 1: y=a+b;break;case 0: y=a-b;break;}
    C: switch a{default: x=a+b;case 10: y=a-b;break;case 11: x=a*b;break;
    D: switch(a+b){case10: x=a+b;break;case11: y=a-b;break;}
  • 举一反三