the variable'discount' is being used without being initializ
来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/27 05:43:49
the variable'discount' is being used without being initialized
int _tmain(int argc,_TCHAR* argv[])
{float price,weigh,distance,f,discount;
int c;
printf("Please enter the price,weigh,distance:\n");
scanf("%lf%lf%lf",&price,&weigh,&distance);
if(distance>=3000)
c=12;
else c=distance/250;
switch(c)
{case 0:discount=0;break;
case 1:discount=2;break;
case 2:
case 3:discount=5;break;
case 4:
case 5:
case 6:
case 7:discount=8;break;
case 8:
case 9:
case 10:
case 11:discount=10;break;
case 12:discount=15;break;
default:printf("\!\n");}
f=price*distance*weigh*(1-discount/100);
printf("You have to pay %10.2f\n",f);
return 0;
}
dicount 已经被初始了啊
是discount
int _tmain(int argc,_TCHAR* argv[])
{float price,weigh,distance,f,discount;
int c;
printf("Please enter the price,weigh,distance:\n");
scanf("%lf%lf%lf",&price,&weigh,&distance);
if(distance>=3000)
c=12;
else c=distance/250;
switch(c)
{case 0:discount=0;break;
case 1:discount=2;break;
case 2:
case 3:discount=5;break;
case 4:
case 5:
case 6:
case 7:discount=8;break;
case 8:
case 9:
case 10:
case 11:discount=10;break;
case 12:discount=15;break;
default:printf("\!\n");}
f=price*distance*weigh*(1-discount/100);
printf("You have to pay %10.2f\n",f);
return 0;
}
dicount 已经被初始了啊
是discount
如果switch执行了default路径,discount就没有初始化.比如给distance赋个负数.就算不存在这种情况,按照代码逻辑来说default路径不可能被执行,但编译器也还没聪明到能够发现这一事实.
the variable'discount' is being used without being initializ
The variable 'sele' is being used without being initialized.
C++运行问题:The variable 'Data' is being used without being init
程序出错:The variable 'y' is being used without being initialize
varible is being used without being initialized
,Run-Time Check Failure #3 - The variable 'L' is being used
Run-Time Check Failure #3 - The variable 'r' is being used w
The username chosen is already being used.
without being
the key is already being used by another computer
The computer being used by them is very fast.
This is his only request that the room___after being used.