Bạn thử code sau:
C Code:
#include <conio.h> #include <graphics.h> main() // kiểu trả về của main là gì? { int mh=0, mode=0; initgraph(&mh,&mode,"D:\\BorlandC\\bgi"); // Chỉ rõ thư mục chứa thư viện đồ họa setbkcolor(GREEN); setcolor(RED); setfillstyle(CLOSE_DOT_FILL,YELLOW); rectangle(5,5,300,160); getch(); closegraph(); }
Phải chạy trên môi trường DOS thì thư viện này mới hoạt động!