C语言计算佣金

2016-12-24 08:35:14来源:作者:人点击

第七城市
#include<stdio.h>int main(void){    int shares;    float price,value,commission,rival_commission;    printf("Enter number of shares:");    setvbuf(stdout,NULL,_IONBF,0);    scanf("%d",&shares);    printf("Enter price per share:");    scanf("%f",&price);    value =shares*price;    if(value<2500.00f)        commission=30.00f+.007f*value;    else if (value<6250.00f)        commission=56.00f+.0066f*value;    else if (value <20000.00f)        commission=76.00f+.0024f*value;    else if(value<50000.00f)        commission=100.00f+.0022f*value;    else if(value<50000.00f)        commission=155.00f+.0011f*value;    else        commission=255.00f+.0009f*value;    if(commission<39.00f)        commission=39.00f;    rival_commission=33.00f+(shares<2000?.03f:.02f);    printf("The first broker's commission :$%.2f/n",commission);    printf("The second broker's commission:$%.2f/n",rival_commission);    if(commission<rival_commission)    {        printf("The first broker is the right one./n");    }    else{        printf("The second broker irus the right one./n");    }    return 0;}
第七城市

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台