- 分享
- 0
- 人气
- 0
- 主题
- 10
- 帖子
- 1147
- UID
- 60379
- 积分
- 1662
- 阅读权限
- 19
- 注册时间
- 2007-1-24
- 最后登录
- 2013-5-22
- 在线时间
- 792 小时
|
#include<stdio.h>
#define price_of_rose 2.30
#define discount 0.1
const float price_of_lily = 3.90 ;
void main()
{
int quantity_of_rose,quantity_of_lily;
float total_price_of_rose,total_price_of_lily,total,discount_value,payment;
printf("------------------------------------\n");
printf("- FLOWER FLORIST -\n");
printf("------------------------------------\n");
printf("Enter amount of ROSE : ");
scanf("%f",&quantity_of_rose);
printf("Enter amount of Lily : ");
scanf("%f",&quantity_of_lily);
total_price_of_lily = quantity_of_lily * price_of_lily;
total_price_of_rose = quantity_of_rose * price_of_rose;
total = total_price_of_rose + total_price_of_lily;
discount_value = total * discount;
payment = total - discount_value;
printf("------------------------------------\n");
printf("- PAYMENT RECEIPT -\n");
printf("------------------------------------\n");
printf("ROSE : $%.2f [%.0f stalks]\n",total_price_of_rose,quantity_of_rose);
printf("LILY : $%.2f [%.0f stalks]\n",total_price_of_lily,quantity_of_lily);
printf("TOTAL : $%.2f\n",total);
printf("DISCOUNT : $%.2f\n",discount_value);
printf("------------------------------------\n");
printf("PAYMENT : $%.2f\n",payment);
printf("------------------------------------\n");
getche();
}
为什么跳出来的数字这样多??? |
|