Page 160 - C Programming
P. 160

ตัวอย่างที่12-1 โปรแกรมแสดงค่าการกดสวิตซ์ sw0 ถึง sw4






               #include<stdio.h>


                main()


                           { char chk_sw;


                              clrscr();


                              printf(“*******************\n”);


                              printf("Program Check Switch\n");



                              printf(“*******************\n”);


                              do{  chk_sw=inport(0x379);


                                      gotoxy(1,4);  printf("Data inport[0x379] = %.3d \n",chk_sw);


                                   }while(!kbhit());



                              getch();


                           }
   155   156   157   158   159   160   161   162   163   164   165