| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 556 人关注过本帖
标题:求救!!
只看楼主 加入收藏
shmilysw
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-11
收藏
 问题点数:0 回复次数:4 
求救!!
这个程序有什么错误??
为什么incoming好像被赋值了8300?
#include"math.h"
#include"stdio.h"
main()
{  int profile,incoming,real;
   scanf("The incoming is %d .\n",incoming);
   real=incoming*0.1;
   printf("%d",real);
   switch(real)
        {
   case  10 :  profile=10*0.1+10*0.1+20*0.075+20*0.03+40*0.015+(incoming-100)*0.01; break;
   case   9 :
   case   8 :
   case   7 :
   case   6 :  profile=10*0.1+10*0.1+20*0.075+20*0.03+(incoming-60)*0.015;  break;
   case   5 :
   case   4 :  profile=10*0.1+10*0.1+20*0.075+(incoming-40)*0.03;   break;
   case   3 :
   case   2 :  profile=10*0.1+10*0.1+(incoming-20)*0.075;  break;
   case   1 :  profile=10*0.1+(incoming-10)*0.1;  break;
   case   0 :  profile=incoming*0.1;  break;
        }
   printf("The profile is %d.\n",profile);
}

搜索更多相关主题的帖子: include profile 
2005-07-13 16:18
牛虻
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2004-10-1
收藏
得分:0 
以下是引用shmilysw在2005-7-13 16:18:15的发言: 这个程序有什么错误?? 为什么incoming好像被赋值了8300? #include"math.h" #include"stdio.h" main() { int profile,incoming,real; scanf("The incoming is %d .\n",incoming); //楼主的本意应该为printf("The incoming is");scanf("%d",&incoming); real=incoming*0.1; printf("%d",real); switch(real) { case 10 : profile=10*0.1+10*0.1+20*0.075+20*0.03+40*0.015+(incoming-100)*0.01; break; case 9 : case 8 : case 7 : case 6 : profile=10*0.1+10*0.1+20*0.075+20*0.03+(incoming-60)*0.015; break; case 5 : case 4 : profile=10*0.1+10*0.1+20*0.075+(incoming-40)*0.03; break; case 3 : case 2 : profile=10*0.1+10*0.1+(incoming-20)*0.075; break; case 1 : profile=10*0.1+(incoming-10)*0.1; break; case 0 : profile=incoming*0.1; break; } printf("The profile is %d.\n",profile); } 

[此贴子已经被作者于2005-7-13 16:46:19编辑过]


土冒
2005-07-13 16:43
shmilysw
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-11
收藏
得分:0 
谢过!!
2005-07-13 16:49
poppylx
Rank: 1
等 级:新手上路
帖 子:367
专家分:0
注 册:2004-9-27
收藏
得分:0 

scanf("The incoming is %d .\n",&incoming);
scanf 函数可以这样调用???

[此贴子已经被作者于2005-7-13 17:16:48编辑过]



动于心而静如水
2005-07-13 17:14
poppylx
Rank: 1
等 级:新手上路
帖 子:367
专家分:0
注 册:2004-9-27
收藏
得分:0 
不好意思  刚刚试了下
确实可以  不过真让人想死

建议不要

动于心而静如水
2005-07-13 17:15
快速回复:求救!!
数据加载中...
 
   



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

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