若a和b均是正整型变量,正确的switch语句是______。
A: switch(pow(a, 2)+pow(b, 2))(注:调用求幂的数学函数){ case 1: case 3: y=a+b; break;ease 0: ease 5: y=a-b;}
B: switch(a*a+b*b);{ ease 3:ease 1: y=a+b; break;case 0: y=b-a; break;}
C: switch a{default:x=a+b;case 10: y=a-b; break;case 11: x=a*d; break;}
D: switch(a+b){ ease10: x=a+b; break;ease11: y=a-b; break;}
A: switch(pow(a, 2)+pow(b, 2))(注:调用求幂的数学函数){ case 1: case 3: y=a+b; break;ease 0: ease 5: y=a-b;}
B: switch(a*a+b*b);{ ease 3:ease 1: y=a+b; break;case 0: y=b-a; break;}
C: switch a{default:x=a+b;case 10: y=a-b; break;case 11: x=a*d; break;}
D: switch(a+b){ ease10: x=a+b; break;ease11: y=a-b; break;}
举一反三
- 若a和b均是正整型变量,正确的switch语句是( ) A: switch(pow(a,2)+pow(b,2)) {case 1:case: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=b-a; break; } C: switch a{default:x=a+b; case 10:y=a-b;break;case 11:y=a-b;break;} D: switch(a+b){case 10:x=a+b;break;case 11:y=a-b;break;}
- 若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;}
- 若a、b、c1、c2、x、y均是整型变量,正确的switch语句是______。①switch(a+b);{ case 1:y=a+b;break;case 0:y=a-b;break;}②switch(a*a+b*b){ case 3:case 1:y=a+b;break;case 3:y=b-a;break;}③switch { case c1:y=a-b;break;case c2:x=a*b;break;default:x=a+b;}④switch (a-b){ default:y=a*b;break;case 3:case 4:x=a+b;break;case 10:case 11:y=a-b;break;} A: ① B: ② C: ③ D: ④
- 若a、b、c1、c2、x、y均是整型变量,以下正确的switch语句是 A: swich(a+b);{ case 1 : y=a+b; break;case 0 : y=a-b; break; } B: switch(a*a+b*b){ case 3 :case 1 : y=a+b; break;case 3 : y=b-a, break; } C: switch a{ case c1 : y=a-b; break;case c2 : x=a*d; break;default : x=a+b; } D: switch(a-b){ default : y=a*b; break;case 3 : case 4 : x=a+b;break;case 10 : case 11: y=a-b: break; }
- 若a和b均是整型变量,以下正确的switch语句是( )。 A: switch(a/b) {case 0:case1.5:y=a+b;break; case 2:case 3:y=a-b; } B: switch(a*a+b*b); { case0:y=a+b;break; case1:y=b-a;break; } C: switch a {case 0:x=a+b; case 1:y=a-b;break;} D: switch(a+b) {case 0:x=a+b;break; case 1:y=a-b;break; }