请写出与以下else-if语句等价的switch语句。if(choice == 1){ price = 3.0; }else if(choice == 2){ price = 2.5; }else if(choice == 3){ price = 4.0; }else if(choice == 4){ price = 3.5; }else{ price = 0.0; }switch{case 1: break; price=2.5; break;case 3:price=4.0;break;case 4: price=3.5;break;( )price=0.0; break;}
请写出与以下else-if语句等价的switch语句。if(choice == 1){ price = 3.0; }else if(choice == 2){ price = 2.5; }else if(choice == 3){ price = 4.0; }else if(choice == 4){ price = 3.5; }else{ price = 0.0; }switch{case 1: break; price=2.5; break;case 3:price=4.0;break;case 4: price=3.5;break;( )price=0.0; break;}
发布时间:2024-11-01 23:04:04