![]() |
#2
rjsp2018-10-19 16:00
|
using namespace std;
int main()
{
int c;
float total_payment, discount_rate, real_payment;
cout << "plase input total_payment for goods:";
cin >> total_payment ;
c = total_payment / 1000;
switch(c)
{
case 0: discount_rate=1; break;
case 1: discount_rate=0.95; break;
case 3: discount_rate=0.9; break;
case 4:
case 5: discount_rate=0.85; break;
difault : discount_rate=0.8; break;
}
real_payment = discount_rate * total_payment;
cout << "the real payment is:" << real_payment << endl;
return 0;
}
可是当输入8000元时,结果不对啊,是哪里出错了?
只有本站会员才能查看附件,请 登录