Draw a fish



Here We are going to know how to create a sketch of fish by using c-graphics programming.It is very simple program which is bascially created for the beginners.We have used simple ellipse,circle and line functions in order to draw this very simple object.Here is a code for this:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,"");

ellipse(200,200,0,360,80,30);

line(280,200,310,170);

line(310,170,310,230);

line(310,230,280,200);

circle(140,190,3);

setfillstyle(XHATCH_FILL,RED);

floodfill(200,200,WHITE);

setfillstyle(LINE_FILL,BLUE);

floodfill(290,209,WHITE);

setcolor(LIGHTCYAN);

settextstyle(1,HORIZ_DIR,5);

outtextxy(160,250,"FISH");

getch();

closegraph();

}



In the above code we have used the simple c-graphics functions like ellipse,circle and lines in order to draw a sketch of fish.setfillstyle and floodfill functions are used to fill the color in fish.settextstyle and outtextxy function are used to write a text.You can study these functions in detail from our tutorial Graphics in C.Here is the output of above program:



Output

c_graphics