Page 125 - C Programming
P. 125

ตัวอย่างที่ 9-3  โปรแกรมนาฬิกานับหลักวินาที 00 ถึง 59 วนไปเรื่อยๆ






                         #include<stdio.h>


                          main()


                            {    char sec;


                                  printf("***************\n");


                                  printf("  Program Clock \n");


                                  printf("***************\n");


                                  do{   for(sec=0;sec<60&&!kbhit();sec++)


                                            {   gotoxy(6,4);  printf("Time = [%0.2d]",sec);


                                                 outport(0x378,sec);


                                                 delay(5000);


                                             }


                                       } while(!kbhit());


                                  }
   120   121   122   123   124   125   126   127   128   129   130