|
抱歉,我太年輕了,看了一下你的問題沒看全就會(huì)貼了,重看了一下你的代碼,發(fā)現(xiàn)是這樣的。1 switch函數(shù)沒有帶default語柄 這問題不大
2 按鍵‘=’使用了四個(gè)if判斷加減乘除還用abcd指代,如果我按完 加號(hào)(a = 1)再按減號(hào)(b= 1)會(huì)怎么樣
case(14):if(a==1)
{result=temp+result;a=0;key=0;}
if(b==1)
{result=temp-result;b=0;key=0;}
if(c==1)
{result=temp*result;c=0;key=0;}
if(d==1)
{
if(result==0) {error=1;result=0;d=0;key=0;}
else{result=temp/result;d=0;key=0;}
}
3 你在while(1)里面定義變量是認(rèn)真的嗎?看到這里可以十分肯定告訴你你的錯(cuò)誤99%出現(xiàn)在這
void main()
{
LCD_Init();
while(1)
{
static long key=0,result=0,temp=0,a=0,b=0,c=0,d=0;
unsigned char i=0;
|
|