Graphics in C




Now u can create simple graphics program by using graphics methods in C programming language

/*Graphics in C*/
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
outtextxy(20,8,"****************************");
outtextxy(20,85,"****************************");
outtextxy(40,40,"/**My Sweet Family**/");
settextstyle(GOTHIC_FONT,HORIZ_DIR,5);
outtextxy(30,110,"  AAAA ");
outtextxy(30,270,"  BBBB");
outtextxy(30,150,"  CCCC");
outtextxy(30,190,"  DDDD");
outtextxy(30,230,"  EEEE");
outtextxy(30,320,"******************************");
getch();
}


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
void main()
{
int i;
int gd=DETECT,gm,gx,gy;
initgraph(&gd,&gm,"");
gx=getmaxx();
gy=getmaxy();
gotoxy(42,16);
settextstyle(DEFAULT_FONT,HORIZ_DIR,5);
outtextxy(30,110,"Coimbatore");
for(i=0;i<=200;i++)
{
setcolor(rand()%15);
circle(rand()%gx,rand()%gy,i);
delay(100);
}
getch();
}


/*Create a Face*/
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<alloc.h>
void main()
{
clrscr();
int gdrive=DETECT,gmode;
initgraph(&gdrive,&gmode,"\\tc\\bgi");
circle(160,120,90);
circle(115,95,15);
fillellipse(115,95,4,4);
circle(205,95,15);
fillellipse(205,95,4,4);
line(160,80,160,150);
line(145,145,160,150);
ellipse(160,170,0,360,40,15);
getch();
closegraph();
}





Comments

Popular posts from this blog

TRAVELING SALESMAN USING BRANCH AND BOUND TECHNIQUE

BOOKS DETAILS USING C STRUCTURE

TRAVELING SALESMAN USING BRANCH AND BOUND TECHNIQUE