خوب این هم یه برنامه نمونه:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
initgraph(&gdriver, &gmode, "F:\\Pro\\TC\\BGI");//***masire TC rooye computere shoma***, kheily mohem
setbkcolor(1);//range pas zamineh
setcolor(10); //range matn
xmax = getmaxx();
ymax = getmaxy();
line(0, 0, xmax, ymax); // tabee keshidane khat
setcolor(4);
rectangle(100,100,550,400);//tabee keshidane mostatil
setfillstyle(1,2); //olgooye por kardan
floodfill(101,101,4); //por kardane mostatil
setcolor(14);
settextstyle(8,0,5); //fonte matn
outtextxy(250,200,"Hello!"); //chape matn
getch();
closegraph();
return 0;
}
فقط به مسیر فایل های BGI توجه کنید، یعنی درست مسیری رو بنویسین که رو کامپیوترتونه، در غیر این صورت، برنامه کار نمی کنه!