程序代码:
#include <stdio.h>
#include <conio.h>
//要求用户输入股票数量和单价,采用某种比例计算经理人佣金,并计算竞争对手的佣金
//(小于2000 33美元+0.03)(大于等于2000 33美元+0.02)
int main()
{
int quantity;
float price, money, commission, commission1;
printf("请输入股票数量: ");
scanf("%d", &quantity);
printf("请输入股票单价: ");
scanf("%f", &price);
money = quantity * price;
if (money < 2500.00f)
commission = 30.00f + 0.017f * money;
else if (commission < 6250.00f)
commission = 56.00f + 0.0066f * money;
else if (money < 20000.00f)
commission = 76.00f + 0.0034f * money;
else if (money < 50000.00f)
commission = 100.00f + 0.0022f * money;
else if (money < 500000.00f)
commission = 155.00f + 0.0011f * money;
else
commission = 255.00f + 0.0003f * money;
if (commission < 39.00f)
commission = 39.00f;
printf("经理人的佣金: $%.2f\n", commission);
if (quantity < 2000.00f)
commission1 = 33.00f + quantity * .03f;
else
commission1 = 33.00f + quantity * .02f;
printf("经理人竞争对手的佣金: $%.2f\n", commission1);
printf("按任意键退出..");//亮点在这里。。。。。。。。。。。
getch();
return 0;
}