• 2022-06-28
    以下switch语句结构哪一个是正确的?( )
    A: int a=1,b=0,c1,c2,x,y;switch (a*a+b*b) { case 3: case 1: y=a+b; break; case 3: y=b-a; break;}
    B: int a=1,b=0,c1,c2,x,y;switch a ( ) { case c1: y=a-b; break; case c2: x=a*b; break; default:x=a+b;}
    C: int a=1,b=0,c1,c2,x,y;switch (a*a+b*b) { default:y=a*b;break; case 3: x=a+b; break; case 10: case 11:y=a-b; break;}
    D: int a=1,b=0,c1,c2,x,y;switch (a+b); { case 1: y=a+b; break; case 0: y=a-b; break; }
  • 举一反三