不正确,case 后面紧跟choice 的变量内容,case 1:price=30;break;
switch(choice){ case 1: price = 3.0; break; case 2: price = 2.5; break;case 3: price = 4.0; break;case 4: price = 3.5; break;default: price = 0.0; break;}应该是这样,不用加判断语句