//範例5-10C:多重條件分歧應用實例 //檔名ch5_10.c #include void main() { /* if - else if 判斷P1輸入狀態,決定P0輸出結果 */ P1=0x00; for(;;) { if(P1&0x01) P0=0x80; else if (P1&0x02) P0=0xC0; else if (P1&0x04) P0=0xE0; else if (P1&0x08) P0=0xF0; } }