Page 121 - C Programming
P. 121

ตัวอย่างที่ 9-1 โปรแกรมนับ 0 ถึง 9 โดยแสดงผลของการนับบนจอภาพและบนวงจรหลอดแสดงผล 7


           ส่วนและเมื่อนับ ถึง 9 ให้ออกจากโปรแกรมพร้อมแสดงข้อความ Stop! บนจอภาพ




                                   #include<stdio.h>

                                   main()


                                           {    char i;


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

                                                 printf("  Program Counter 0-9\n");


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

                                                for(i=0;i<10;i++)


                                                    {  gotoxy(5,4);  printf("Counter = [%d]",i);


                                                       outport(0x378,i);

                                                       delay(10000);


                                                       gotoxy(9,5);  printf("Stop!\a");

                                                       getch();


                                                   }


                                           }
   116   117   118   119   120   121   122   123   124   125   126