下边这段程序在tc3.0编译通不过,说是第四行undefined symbol 'bool',不只是怎么回事
#include
#include
void main()
{ double x,i=10000000;
int j=0;
unsigned int quotient,remainder;
bool beginFlag=0,zeroFlag=0;
cout<<"请输入预转换数额(小于1亿):";
cin>>x;
while (x>=100000000 )
{
if (j>=2)
{
cout<<"你的错误输入已达3次,你无权再输入!"< return;
}
cout<<"你输入的金额超出转换范围,请重新输入!"< cout<<"请输入预转换数额(小于1亿):";
cin>>x;
j++;
}
if (x<=0)
{
cout<<"零元整"< return;
} x=floor(x*100 +0.5)/100; //小数点后2位四舍五入
while (i>0.001)
{
if (i>0.9)
quotient=(unsigned int)floor(x/i);
else
{
if (i>=0.099)
quotient=(unsigned int)floor(x*10);
else
quotient=(unsigned int)floor(x*100);
}
remainder=quotient%10;
if (remainder!=0)
beginFlag=1;
if ((zeroFlag==1) && (beginFlag==1) && (i>1000) && (remainder>0))
cout<<"零";
switch (remainder) //输出大写数字
{
case 0:
break;
case 1:
cout<<"壹";
break;
case 2:
cout<<"贰";
break;
case 3:
cout<<"叁";
break;
case 4:
cout<<"肆";
break;
case 5:
cout<<"伍";
break;
case 6:
cout<<"陆";
break;
case 7:
cout<<"柒";
break;
case 8:
cout<<"捌";
break;
case 9:
cout<<"玖";
break;
}
if (remainder>0)
zeroFlag=0;
else if (beginFlag==1)
zeroFlag=1;
if (beginFlag==1) //输出单位
{
if ((i==10000000) && (remainder>0))
cout<<"仟";
if ((i==1000000) && (remainder>0))
cout<<"百";
if ((i==100000) && (remainder>0))
cout<<"十";
if (i==10000)
cout<<"万";
if ((i==1000) && (remainder>0))
cout<<"仟";
if ((i==100) && (remainder>0))
cout<<"百";
if ((i==10) && (remainder>0))
cout<<"十";
if (i==1)
cout<<"元";
if ((i>=0.09) && (i<1) && (remainder>0))
cout<<"角";
if ((i>=0.009) && (i<0.1) && (remainder>0))
cout<<"分";
}
i=i/10;
}
cout<<"整"<}
--------------------next---------------------
阅读(1056) | 评论(0) | 转发(0) |