2056| 3
|
我想把这个函数把他实现整数负数的转换,并且没有上限怎么实现, |
1金钱
最佳答案double plus_minus(double count)
{
double cnt1,cnt2;
if(count>30000)
{
cnt1=5898.15-count*0.09;
count=TIM4->CNT=0;
sum1=sum1+cnt1;//sum1为负
}
else
{
cnt2=count*0.09;
count=TIM4->CNT=0;
sum2=sum2+cnt2;
}
//可以通过每次加到多少后再判断清零
if(sum2-sum1>=0)
{
zong1=sum2-sum1;
sum2=zong1;
sum1=0;
zong2=zong1;
return zong1 ...
| ||
| ||
| ||
| ||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-6-23 04:56
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网