Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99244
  • 博文数量: 102
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1011
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-15 13:58
个人简介

普普通通一个人

文章分类

全部博文(102)

文章存档

2018年(1)

2015年(13)

2014年(88)

我的朋友

分类: C/C++

2014-02-09 22:07:41


点击(此处)折叠或打开

  1. #include <stdio.h>

  2. int main(){
  3.     float f_profit, f_bonus;

  4.     while (scanf_s("%f", &f_profit) != EOF){
  5.         if (f_profit <= 10)
  6.             f_bonus = f_profit * 0.1;
  7.         if (f_profit > 10 && f_profit <= 20)
  8.             f_bonus = (f_profit - 10) * 0.075 + 1;
  9.         if (f_profit > 20 && f_profit <= 40)
  10.             f_bonus = (f_profit - 20) * 0.05 + 1 + 0.75;
  11.         if (f_profit > 40 && f_profit <= 60)
  12.             f_bonus = (f_profit - 40) * 0.03 + 1 + 0.75 + (0.5 * 2);
  13.         if (f_profit > 60 && f_profit <= 100)
  14.             f_bonus = (f_profit - 60) * 0.015 + 1 + 0.75 + (0.5 * 2) + (0.3 * 2);
  15.         if (f_profit > 100)
  16.             f_bonus = (f_profit - 100) * 0.01 + 1 + 0.75 + (0.5 * 2) + (0.3 * 2) + (0.15 * 4);

  17.         printf("the bonus is %.2f!\n", f_bonus);
  18.     }
  19.     return 0;
  20. }

阅读(176) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~