Lets Understand TURBO C Graphics

 FROM ENABLING GRAPHIC.H LIBRARY TO MAKING A GRAPHIC PROJECT IN TURBO C


So EID is coming and we are coders. Let's keep both things in mind and let's draw some graphics in C language.


HOW TO ENABLE "GRAPHIC.H" in TURBO C ?

1. Open the DOSBOX by Clicking on Start turbo C++

2. At the top grey line you can see Options, Press it.

3. Go to Linker

4. Go to Libraries

5. So here we go 

Now you will see something like this :

[] graphics

Modify it to :

[X] graphics

Simple :))

If struck follow the below video tutorial :


{ coming soon }



Let's make a simple graphic project and let's see in action.


C Code :

#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
#include<conio.h>
#include<time.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#define ScreenWidth getmaxx()
#define ScreenHeight getmaxy()
#define GroundY ScreenHeight*0.75

void Rain(int x){
int i, rx, ry;
for(i=0;i<400;i++)
{
rx = rand()%ScreenWidth;
ry = rand()%ScreenHeight;
if (ry<GroundY)
line(rx-10,ry-10,rx,ry);
}
}
void main(){
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\turboc3\\BGI");
int x=0;
while(!kbhit())
{
settextstyle(BOLD_FONT,HORIZ_DIR,1);
setcolor(YELLOW);
outtextxy(120,5,"HAPPY EID BY TECH_ED");
setcolor(WHITE);
arc(135,190,87,335,110);
arc(165,173,99,314,95);
settextstyle(TRIPLEX_SCR_FONT, HORIZ_DIR,4);
outtextxy(255,130,"\" EID-UL_FITAR \"");
outtextxy(285,180,"\" MUBARAK \"");
setcolor(CYAN);
outtextxy(15,350,"EID MUBARAK ! MAY THIS SPECIAL DAY BRING PEACE,");
outtextxy(15,375,"HAPPINESS AND PROSPERITY TO EVERYONE");
setcolor(BROWN);
outtextxy(15,410,"Remember me in your prayers. Eid Mubarak!");
gotoxy(20,10);
setcolor(WHITE);
printf("*");
Rain(x);
delay(95);
cleardevice();
}
getchar();
closegraph();
}


OUTPUT :

Eid Mubarak




If you get something out of it pls like the video and subscribe TECH_ED.

Keep Learning
Stay Safe