Sunday 31 March 2013

Simple Line Drawing In Turbo C Graphics

Well this post consists of the source code for very very simple line drawing using the in-built functions.
#include <stdio.h>
#include <conio.h>
#include <graphics.h>

int main()
{
 int gd = DETECT, gm;
 initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
 line(100, 100, 350, 100);
 line(100, 100, 70, 140);
 line(70, 140, 130, 140);
 line(350, 100, 380, 140);
 rectangle(70, 140, 130, 200);
 rectangle(130, 140, 380, 200);
 getch();
 closegraph();
 return 0;
}


I hope it proves useful for learning purpose.