/*按鍵動作函數(shù),根據相應鍵碼執(zhí)行相應動作。keycode——按鍵編碼*/
void keyaction(unsigned char keycode)
{
static unsigned long jieguo=0; //用于保存計算結果
static unsigned long jiashu=0; //用于保存輸入的加數(shù)
if((keycode>=0x30)&&(keycode<=0x39))//鍵盤輸入0~9
{
jiashu=(jiashu*10)+(keycode-0x30); //將輸入數(shù)字向高移一位,同時將新輸入的數(shù)字作為個位
shownumber(jiashu); //將輸入數(shù)字顯示在數(shù)碼管上
}
else if(keycode==0x26) //輸入向上鍵進行加法計算
{
jieguo + = jiashu; //加法計算
jiashu=0; //輸入加數(shù)清零
shownumber(jieguo); //將結果顯示在數(shù)碼管
}
else if(keycode==0x0D) //輸入回車鍵進行加法計算
{
jieguo + = jiashu; //加法計算
jiashu=0;
shownumber(jieguo); //將結果顯示在數(shù)碼管
}
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; //加法計算
|