显示的是乱码,不知哪里错了?
void writshuju(float shu) { uint j; uchar bai,shi,ge,shifen; j=shu*10; bai=j/1000; shi=j%1000/100; ge=j%1000%100/10; shifen=j%10; if(bai==0) bai=' '; //当百位为0时就用空格,(百位消隐) if((bai==0)&&(shi==0)) //当百位为0,十位也为0时就用空格,(百位和十位都消隐) { bai=' '; shi=' '; } if((bai==0)&&(shi==0)&&(ge==0)) { bai=' '; shi=' '; ge=0; }
write_dat(bai); write_dat(shi); write_dat(ge); write_dat('.'); write_dat(shifen); write_dat(baifen); } |