|

楼主 |
发表于 2024-3-28 19:51:15
|
显示全部楼层
你可以告诉我我的语法错误具体出现在哪里吗?
#include <stdio.h>
#include <math.h>
int main()
{
float month,quantity,price,total_price;
printf("请输入旅游的月份,订票的数量,单张票价:");
scanf("%f,%f,%f",&month,&quantity,&price);
total_price = quantity * price;
if month in [4, 5, 9, 10]
switch_case = {
True: total_price * 0.8, # 订票数量大于等于10张
False: total_price * 0.9 # 订票数量小于10张
}
else: # 旅游淡季
switch_case = {
True: total_price * 0.6, # 订票数量大于等于10张
False: total_price * 0.8 # 订票数量小于10张
}
discounted_price = switch_case[quantity >= 10]
print("订票总价格为:", discounted_price)
return 0;
} |
|