该楼层疑似违规已被系统折叠隐藏此楼查看此楼
case 0x7b: dengyu=1; //key=11; //wei++; break; } while(temp!=0xf0) { temp=P3; temp=temp&0xf0; beep=0; } beep=1; } } P3=0xf7; temp=P3; temp=temp&0xf0; if(temp!=0xf0) { delay(10); if(temp!=0xf0) { temp=P3; switch(temp) { case 0xe7: jia=1; //key=12; // wei++; break;
case 0xd7: jian=1; break;
case 0xb7: cheng=1; break;
case 0x77: chu=1; break; } while(temp!=0xf0) { temp=P3; temp=temp&0xf0; beep=0; } beep=1; } }}}
void display0(){if(key!=20){switch(wei){case 1: a0=key;b0=16;c0=16;d0=16;e0=16;f0=16;break;case 2: b0=key;c0=16;d0=16;e0=16;f0=16;break;case 3: c0=key;d0=16;e0=16;f0=16;break;case 4: d0=key;e0=16;f0=16;break;case 5: e0=key;f0=16; break;case 6: f0=key;//wei=0;break;}key=20;}display(a0,b0,c0,d0,e0,f0);if(a0!=16) s5=a0;if(b0!=16) s4=b0;if(c0!=16) s3=c0;if(d0!=16) s2=d0;if(e0!=16) s1=e0;if(f0!=16) s0=f0;}
void main(){uchar gongneng,yunsuan; while(1){ keyscan();gongneng=jia|jian|cheng|chu|dengyu|qingling;if(gongneng==0){display0();}else{ yunsuan=jia|jian|cheng|chu;if(yunsuan){a0=16;b0=16;c0=16;d0=16;e0=16;f0=16;//wei=0;if(jia){jia=0;jia0=1;jian0=0;cheng0=0;chu0=0;}if(jian){jian=0;jia0=0;jian0=1;cheng0=0;chu0=0;}if(cheng){cheng=0;jia0=0;jian0=0;cheng0=1;chu0=0;}if(chu){chu=0;jia0=0;jian0=0;cheng0=0;chu0=1;}switch(wei){case 6:qian=s5*100000+s4*10000+s3*1000+s2*100+s1*10+s0;break;case 5:qian=s5*10000+s4*1000+s3*100+s2*10+s1;break;case 4:qian=s5*1000+s4*100+s3*10+s2;break;case 3:qian=s5*100+s4*10+s3;break;case 2:qian=s5*10+s4;break;case 1:qian=s5;break;}wei=0;s0=0;s1=0;s2=0;s3=0;s4=0;s5=0;display(a0,b0,c0,d0,e0,f0);//P1=0x55;}if(dengyu){ dengyu=0; //display(16,16,16,16,16,16); switch(wei){case 6:hou=s5*100000+s4*10000+s3*1000+s2*100+s1*10+s0;break;case 5:hou=s5*10000+s4*1000+s3*100+s2*10+s1;break;case 4:hou=s5*1000+s4*100+s3*10+s2;break;case 3:hou=s5*100+s4*10+s3;break;case 2:hou=s5*10+s4;break;case 1:hou=s5;break;}wei=0;s0=0;s1=0;s2=0;s3=0;s4=0;s5=0; if(jia0) {jia0=0;hou=qian+hou;} if(jian0) {jian0=0;hou=qian-hou;} if(cheng0) {cheng0=0;hou=qian*hou;} if(chu0) {chu0=0;hou=qian/hou;} if(hou<10) { a0=hou;b0=16;c0=16;d0=16;e0=16;f0=16; } else { if(hou<100){a0=hou/10;b0=hou%10;c0=16;d0=16;e0=16;f0=16;}else{if(hou<1000){a0=hou/100;b0=hou%100/10;c0=hou%10;d0=16;e0=16;f0=16;}else{if(hou<10000){a0=hou/1000;b0=hou%1000/100;c0=hou%100/10;d0=hou%10;e0=16;f0=16;}else{if(hou<100000){a0=hou/10000;b0=hou%10000/1000;c0=hou%1000/100;d0=hou%100/10;e0=hou%10;f0=16;}else{if(hou<1000000){a0=hou/100000;b0=hou%100000/10000;c0=hou%10000/1000;d0=hou%1000/100;e0=hou%100/10;f0=hou%10;}}}}} } display(a0,b0,c0,d0,e0,f0); P1=hou;}if(qingling){a0=16;b0=16;c0=16;d0=16;e0=16;f0=16;s0=0;s1=0;s2=0;s3=0;s4=0;s5=0;jia=0;jian=0;cheng=0;chu=0;jia0=0;jian0=0;cheng0=0;chu0=0;qingling=0;dengyu=0;qian=0;hou=0;display(a0,b0,c0,d0,e0,f0);}}
}}
如果觉得《一个简单51c语言程序 求一个 89C51 简易计算器的c语言程序 只要加减乘除就行!...》对你有帮助,请点赞、收藏,并留下你的观点哦!