如果成员资格为p &&金额> 1000.00,则对其进行计算。 如果成员资格为d &&金额> 750.00,则对其进行计算。
for (customer=1; customer<6; customer++){
printf("\nCustomer %d",customer);
printf("\nEnter membership level: ");
scanf("%c",&membership);
printf("\nEnter Purchase amount: ");
scanf("%f",&amount);
检查客户状态 切换(成员){
case 'p':
case 'P':
/*check if the status is premium*/
discount1 = amount * 0.10;
discount2 = amount - discount1;
printf("\nYou are eligible for TEN PERCENT discount.");
printf("\nAmount payable : %.2f\n",discount2);
printf("-------------------------------------");
break;
case 'd':
case 'D':
check if the status is ordinary
discount1 = amount * 0.05;
discount2 = amount - discount1;
printf("\nYou are eligible for FIVE PERCENT discount.");
printf("\nAmount payable : %.2f\n",discount2);
printf("-------------------------------------");
break;
default :
printf("\nSorry. Invalid membership level. Enter m for ordinary or premium.");
break;
}
}