#include<stdio.h>
//利润率在45%以上按照100元提成5元
//利润率在30%-45%之间按照100元提成3元
//利润率在30%以下不提成 
int main()
{
    system("color 0E");
    float profitmargin;     //利润率 
    float price;     //售价 
    float cost;     //成本 
    int commission;     //提成 
    int salesvolume;     //销售量 
    int all;     //总价格 
    int output;
    
    printf("提成计算 测试版1.0\n");
    printf("\n");
    printf("请输入成本:");
    scanf("%f",&cost);
    printf("\n");
    printf("请输入售价:");
    scanf("%f",&price);
    printf("\n");
    printf("请输入销售量:");
    scanf("%d",&salesvolume);
    printf("\n");
    all=salesvolume*price;        
    profitmargin=(price-cost)/cost;
    output=all/100;
    if(profitmargin>=0.45)
    {
        commission=output*5;
    }
    else if(profitmargin>=0.3&&profitmargin<0.45)
    {
        commission=output*3;
    }
    else
    commission=output*1;
    
    printf("您的商品信息:\n");
    printf("成本:%.2f\n售价:%.2f\n销售量:%2d\n总收入:%2d\n总提成:%2d\n",cost,price,salesvolume,all,commission);
    system("PAUSE");
}//
个人算法,已经测试成功!