Loading....
Coupon Accepted Successfully!

 

Drawing Noncommon Figures

The following program illustrates the use of drawpoly() function. With this patterns of non-common shapes can be drawn.

22.22 Draw non-common shape patterns and fill it with some color.

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

#include<stdlib.h>

int main()

{

int arr[8];

int gd =DETECT,gm,x,y;

initgraph(&gd,&gm,“c:\\turboc3\\tc\\bgi”);

setcolor(GREEN);

outtextxy(10,30,“NONCOMMON SHAPE”);

setcolor(GREEN);

arr[0]=20;

arr[1]=50;

arr[2]=60;

arr[3]=80;

arr[4]=100;

arr[5]=200;

arr[6]=arr[0];

arr[7]=arr[1];

fillpoly(3,arr);

drawpoly(3,arr);

getch();

closegraph();

restorecrtmode();

return 0;

}

Explanation: This program uses drawpoly() and fillpoly() functions. The programmer can run the program and see output. You will get non-regular shape figure with filled color on the screen.





Test Your Skills Now!
Take a Quiz now
Reviewer Name