标题:高手帮看下下!!!
取消只看楼主
华夏聪哥
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-4-18
结帖率:0
已结贴  问题点数:20 回复次数:0 
高手帮看下下!!!
#include "stdio.h"
#include "conio.h"
#include "math.h"
main()
{
  int grade;
  long profit;
  int salary=500;
  printf("input profit");
  scanf("%ld",&profit);
  grade=(profit-1)/1000;
  switch(grade)
   {
    case 0:salary+=profit*0;break;
    case 1:salary+=profit*0.10;break;
    case 2:
    case 3:
    case 4:salary+=profit*0.15;break;
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:salary+=profit*0.20;break;
    default:salary+=profit*0.25;
   }
  printf("salary is %.2d",salary);
    getch();
}
输入3000时得949  



#include "stdio.h"
#include "conio.h"
#include "math.h"
main()
{
  int grade;
  long profit;
  float salary=500;
  printf("input profit");
  scanf("%ld",&profit);
  grade=(profit-1)/1000;
  switch(grade)
   {
    case 0:salary+=profit*0;break;
    case 1:salary+=profit*0.10;break;
    case 2:
    case 3:
    case 4:salary+=profit*0.15;break;
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:salary+=profit*0.20;break;
    default:salary+=profit*0.25;
   }
  printf("salary is %.2f",salary);
    getch();
}
输3000时得950.00
为什么???

搜索更多相关主题的帖子: default include profit 
2011-04-25 11:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-337830-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.739585 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved