【发布时间】:2021-06-24 02:13:52
【问题描述】:
我的这个函数返回billType,我想在我的主函数中使用这个billType。
int bill()
{
int billType;
printf("Enter bill type (1=utilities, 2=internet) : ");
scanf("%d",&billType);
return billType;
}
这里主要功能:
int main()
{
int discount;
bill();
if(billType == 1)
{
int choice;
printf("\nEnter 1=TNB or 2=SYABAS: ");
scanf("%d", &choice);
if(choice == 1)
{
discount= 0.05;
}
else if(choice == 2)
{
discount= 0.10;
}
}
if(billType == 2)
{
int choice;
printf("\nEnter 1=DIGI, 2=UNIFI or 3=MAXIS FIBRE : ");
scanf("%d", &choice);
discount = 0.05;
}
}
【问题讨论】: