/*按鍵動作函數,根據相應鍵碼執行相應動作。keycode——按鍵編碼*/
void keyaction(unsigned char keycode)
{
static unsigned long jieguo=0; //用于保存計算結果
static unsigned long jiashu=0; //用于保存輸入的加數
if((keycode>=0x30)&&(keycode<=0x39))//鍵盤輸入0~9
{
jiashu=(jiashu*10)+(keycode-0x30); //將輸入數字向高移一位,同時將新輸入的數字作為個位
shownumber(jiashu); //將輸入數字顯示在數碼管上
}
else if(keycode==0x26) //輸入向上鍵進行加法計算
{
jieguo + = jiashu; //加法計算
jiashu=0; //輸入加數清零
shownumber(jieguo); //將結果顯示在數碼管
}
else if(keycode==0x0D) //輸入回車鍵進行加法計算
{
jieguo + = jiashu; //加法計算
jiashu=0;
shownumber(jieguo); //將結果顯示在數碼管
}
else if(keycode==0x1B) //輸入esc鍵,清零結果
{
jieguo=0;
jiashu=0;
shownumber(jieguo); //顯示0
}
}
(78): error C141: syntax error near '=', expected 'sizeof'
(84): error C141: syntax error near '=', expected 'sizeof'
報錯的是這句
jieguo + = jiashu; //加法計算
|