JBTALKS.CC

标题: c#的求救。。。 [打印本页]

作者: ~!@!LAzYpIg!@!~    时间: 2010-2-22 02:24 AM
标题: c#的求救。。。
#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();
}



为什么跳出来的数字这样多???
作者: ~!@!LAzYpIg!@!~    时间: 2010-2-22 03:56 PM
解决了。。




欢迎光临 JBTALKS.CC (https://www.jbtalks.cc/) Powered by Discuz! X2.5