สื่อการสอนการเขียนโปรแกรมภาษาซี ระดับชั้น ม. 6

กลับหน้าหลัก

คำสั่งควบคุมลำดับการทำงาน for
รูปแบบ
for (ค่าเริ่มต้น;เงื่อนไข;ค่าที่เปลี่ยนแปลง)
{
    คำสั่ง 1;
    คำสั่ง 2;
     ...;
}

ตัวอย่าง Flowchart การทำงาน


ตัวอย่าง source code จาก flowchart
#include  <stdio.h>
#include  <conio.h>
#include  <graphics.h>
void main()
{
     clrscr();
     int i=0;
     int gdriver = DETECT, gmode, errorcode;
     initgraph(&gdriver, &gmode, "c:/tc/bgi/");
     for (i=0;i<200;i=i+50)
     {
         circle(i,200,50);
     }
     getch();
     closegraph();
}

กลับหน้าหลัก |