请问bool类型怎么用啊??以下述程序为例???????
int count;printf("请输入本月用电量:\n");
scanf("%d",&count);
double f;
bool flag=false;
switch(count / 50)
{
case 0:
{
f = 0.5 * count;
break;
}
case 1:
{
f = 0.8 * (count - 49) + 24.5;
break;
}
case 2:
case 3:
{
f = 1.2 * (count - 99) + 64.5;
break;
}
default:
{
flag = true;
break;
}
}
if(!flag)
{
printf("本月电费是%f\n",f);
}
else
{
printf("用电量非法,报上级调查!\n");
}