#include <stdio.h>
int main()
{
char ticketType;
int totalBill, studAmount, ticketType_R= 6500, ticketType_G= 7500;
printf("\nEnter your ticket type: ");
scanf("%c", &ticketType);
printf("\nEnter amount of students: ");
scanf("%d", &studAmount);
if(ticketType==ticketType_R)
{
totalBill==studAmount*6500;
printf("\nYour ticket type is R and your total bill is: %d", ticketType_R, totalBill);
}
if (ticketType==ticketType_G)
{
totalBill==studAmount*7500;
printf("\nYour ticket type is G and your total bill is: %d", ticketType_G, totalBill);
}
printf("\nThe amount of students attending are: %d ", studAmount);
return 0;
}
我尝试了上面的代码,我希望它
1.用户选择的票据类型
1.打印学生出席人数
1.将学生人数乘以机票价格即可计算出总人数
1.打印总额
1条答案
按热度按时间yuvru6vn1#
在你的情况下,我相信你要计算的价值根据门票类型和学生人数。
这就是我们可以做到的:
如果你有兴趣用Python来做这件事,那就是你要做的。