应用:计算运费
每公里每吨货物的基本运费为p(price),货物重为w(weight),距离为s,折扣为d(discount),则总运费f(freight)的计算公式为 freight=price*weight*s*(1-discount)
用switch求分段函数
应用:计算运费
每公里每吨货物的基本运费为p(price),货物重为w(weight),距离为s,折扣为d(discount),则总运费f(freight)的计算公式为 freight=price*weight*s*(1-discount)
用switch求分段函数