一家水果店出售4种水果,每千克价格分别是:苹果1.15元,桔子1.20元,香蕉0.95元,菠萝0.85元,
编一程序使售货员主要从键盘上打入货品的代码及重量,计算机将显示货品名、单价、重量及总价。
货品代码为苹果1,桔子2,香蕉3,菠萝4。
參考答案:楼上的也太不厚道了,用c语言.
var
integer i;
double f;
begin
write('which one do you choose?(1:Ap,2:Or,3:Ba,4:Pi):');
readln(i);
write('how much do you want:');
readln(f);
case i of
{
1: writeln('apple:1.15/kg ',f,' ',f*1.15);
2: writeln('orange:1.20/kg ',f,' ',f*1.20);
3: writeln('banana:0.95/kg ',f,' ',f*0.95);
4: writeln('pineapple:0.85/kg ',f,' ',f*0.85);
end;
end.