#include <stdio.h>
void main()
{
double lr,jj,lr_10,lr_20,lr_40,lr_60,lr_100;//数轴定义奖金 lr=利润 jj=奖金
printf("请输入当年利润:万元");
scanf("%d",lr);//接收输入
//计算
lr_10=(lr-10)*0.75;
lr_20=lr_10+(lr-20)*0.5;
lr_40=lr_20+(lr-40)*0.3;
lr_60=lr_40+(lr-60)*0.15;
lr_100=lr_60+(lr-100)*0.1;
//条件运行
if (lr<10)
printf("奖金为:%fl",lr*.0.1);
else if(10<=lr<=20)
printf("奖金为:%fl",lr_10);
else if(20<=lr<=40)
printf("奖金为:%fl",lr_20);
else if(40<=lr<=60)
printf("奖金为:%fl",lr_40);
else if(60<=lr<=100)
printf("奖金为:%fl",lr_60);
else if(lr>100)
printf("奖金为:%fl",lr_100);
}
以上是小弟写的一个小程序,小弟初C++
程序可以编译 一运行就出错。
提示程序错误 0x00402348指引的0xcccccccc 不能为written
跪求解答。。。
[此贴子已经被作者于2007-7-25 16:18:08编辑过]
----------------解决方案--------------------------------------------------------
printf("奖金为:%fl",lr*.0.1);~~~~~~~
printf("奖金为:%lf",lr*.0.1);
----------------解决方案--------------------------------------------------------
多谢楼上解答
我该过试了。依然报错 是程序报错。程序不能运行
是不是我的vc++程序本身装的有问题。。
再次感谢楼上
----------------解决方案--------------------------------------------------------
如图。。
----------------解决方案--------------------------------------------------------
并且。。。。
很多程序都是如此。。。
----------------解决方案--------------------------------------------------------
提示程序错误 0x00402348指引的0xcccccccc 不能为written
这好像指的是内存错误
不是指你的程序变错了
可能是你使用的软件在编译的时候占用了你错误的内存,
建议一下重新装一下软件
----------------解决方案--------------------------------------------------------
恩
感谢楼上两位的解答。。
大恩不言谢啊。
啥都不说了。。。
我重装下试试
----------------解决方案--------------------------------------------------------
VC下直接写控制台程序,楼主太强了。
----------------解决方案--------------------------------------------------------
60<=lr<=100???
if (lr<10)
printf("奖金为:%fl",lr*.0.1);
else if(10<=lr<=20)
printf("奖金为:%fl",lr_10);
else if(20<=lr<=40)
printf("奖金为:%fl",lr_20);
else if(40<=lr<=60)
printf("奖金为:%fl",lr_40);
else if(60<=lr<=100)
printf("奖金为:%fl",lr_60);
else if(lr>100)
printf("奖金为:%fl",lr_100);???
这样的if-else嵌套太让人难以理解了!!
建议if{}
else{}
这样的格式。或者switch(a)语句!!!
----------------解决方案--------------------------------------------------------
scanf("%d",lr);//接收输入
这个错了吧,这样就可以了scanf("%d",&lr);//接收输入
----------------解决方案--------------------------------------------------------