本帖最后由 yoookr 于 2009-9-9 09:14 编辑
如果有如下一段代码:
float i = 13.2;
unsigned char j;
unsigned char a1;
unsigned char a2;
unsigned char a3;
j = (unsigned char) i*2*10; //j=264?
a1 = j/100; //a1=2?
a2 = (j-a1*100)/10; //a2=6?
a3 = j-a1*100-a2*10; //a3=4?
我准备用来把每一位分开来去用数码管显示,这样可行?注释是否正确? |