小白求教
某宾馆共有50个标准间,假设一个标准间定价为356元,宾馆规定:预定10房间及以上的团队优惠20%;不足10房间的团队优惠10%;请你根据预定房间数,计算出应付总房费。
大概这样:
#include <stdio.h>
// 房间总数
const int MAX_COUNT = 50;
// 标准间定价
const int PRICE = 356;
int main()
{
// 订房数
int count = 0;
scanf("%d", &count);
if (count > MAX_COUNT || count < 1)
printf("房间数输入有误!\n");
// 折扣
float discount = 0;
if (count >= 10)
discount = 0.2;
else
discount = 0.1;
// 输出结果
printf("%f\n", count*PRICE*discount);
}