Practical – 01
Line Statement:
The line statement we use in C programming for graphics and it is a part of
GRAPHICS.H header file.
Through line statement we can draw lines for creating shapes in our programs. In
this practical we learn how to create lines and make shapes through line statement.
It is necessary to create Computer Graphics through C programming.
The syntax shows four values x1, y1, x2, y2. The first two values are x1, y1 are for
initial point or pixel address where you start the line and the second part is x2, y2
which is for last of ending point of the line.
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main (void)
{
clrscr ();
int gd,gm;
gd=DETECT;
initgraph (&gd, &gm,"c:\\tc\\bgi"); // initializing graphics
}/end of program.
Output:
Create a triangle
Output:
Output:
Figure 1.3: How to draw Cross Line Triangle which intersects each other.
Output:
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
Output:
Figure 1.5: How to make a Hut through Line statement on C Graphics mode
Practical – 02
Object: Draw circular shapes with ARC, CIRCLE & PIESLICE statements in C.
Tool: Turbo C++ compiler of Borland
Language: C.
ARC Statement:
The arc statement we use in C programming for draw curve on the screen and it is
a part of GRAPHICS.H header file. With arc we can draw curves in the 0-360 degree
dimensions. Mostly it use in drawings or graphical work in C.
The syntax of arc shows the values we are required for draw a shape of curve , which are
depend on six type of value . all values are same like arc in pieslice But CIRCLE have
on three type values midx,midy & radius , circle not use stangle(Start angle) &
endangle(END ANGLE) parameters.
stangle: It means start angle, from where the arc curve starts.
endangle: It shows the end point in angle where the curve stop
or limit of curve.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main(void)
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
getch();
Output:
It is also a function <graphics.h> header file which look a cut part of a circle. Like a
piece of PIZZA .
Syntax of PIESLICE.
Pieslice(midx,midy,stangle,endangle,radius);
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main(void)
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
getch();
Output:
Normally in freehand we use a campus and a pencil with it to draw shape of a circle. In C
give value center of the circle and then its radius.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main(void)
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
getch();
}
Output:
{ clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\tc\\bgi");
arc(250,180,90,270,105);//moon
arc(220,180,90,270,100);
///////////////////////////////////////////////////////
line(250,140,210,210); //Star
line(250,140,290,210);
line(210,210,290,160); //left line diagonal
line(290,160,210,160); //Horizontal
line(210,160,290,210); //right line diagonal
///////////////////////////////////////////////////////
line(380,140,350,40);
line(380,140,410,40);
arc(380,65,40,140,40);
arc(380,70,40,138,38);
arc(380,75,40,136,34);
pieslice(380,140,310,230,30);
circle(380,160,20);
circle(380,160,30);
//////////////////////////////////////////////////////////////
line(320,0,320,480);
line(0,300,640,300);
////////////////////////////////////////////////////////
setcolor(RED+GREEN);
circle(60,380,50);
outtextxy(40,380,"CIRCLE");
//////////////////////////////////////////////////////////
setcolor(BLUE+WHITE+YELLOW);
arc(160,380,0,135,30);
outtextxy(160,380,"ARC");
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
setcolor(GREEN);
outtextxy(340,320,"Syed Salman Mehdi");
setcolor(GREEN+BLUE);
outtextxy(340,340,"06IT29 QUEST Nawabshah");
setcolor(RED+WHITE+BLUE);
outtextxy(340,360,"Practical #2,Computer Graphics");
getch();
}
Output:
Practical – 03
Object: Draw line shapes with help of “SETLINESTYLE” and Drawing a poly
lines with “DRAWPOLY” statements in C.
Tool: Turbo C++ compiler of Borland
Language: C.
Syntax of SETLINESTYLE
In the syntax we gave three values to make a line like:
Program # 1
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#define _num 0
void main(void)
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(GREEN + WHITE);
outtextxy(20,10,"Solid line");
setlinestyle(0,_num,1); // Simple / Solid line
line(20,30,490,30);
setcolor(GREEN + RED);
outtextxy(20,50,"Dotted line");
setlinestyle(1,_num,1); // Dotted line
line(20,70,490,70);
setcolor(RED + BLUE);
outtextxy(20,90,"Center line");
setlinestyle(2,_num,1); //Center line
line(20,110,490,110);
setcolor(BLUE + CYAN);
outtextxy(20,130,"Dashed line");
setcolor(15);
outtextxy(140,170,"\\\\\\\\\\============06IT29============///////");
getch();
}
Syntax of DRAWPOLY(multilinking).
Program # 2
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#define _num 0
void main(void)
{
clrscr();
int gd=DETECT,gm;
setcolor(29 + 33);
outtextxy(153,130,"RECTANGLE by DRAWPOLY Function");
setcolor(43 + 44 + 3);
setlinestyle(0,_num,1); // Rectangle
rectangle(180,140,360,260);
setcolor(33 + 43);
outtextxy(235,195,"Hexagonal"); //Hexagonal
int points[]={200,200,240,160,300,160,340,200,300,240,240,240,200,200};
setcolor(29 + 33 + 43);
drawpoly(7,points);
setcolor(43 + 44 + 3);
outtextxy(10,145,"Parallelogram"); //Parallelogram
int points1[]={10,200,80,160,80,260,10,300,10,200};
setcolor(43 + 33);
drawpoly(5,points1);
setcolor(3 + 44);
outtextxy(340,80,"Pantagonal");
int points2[]={320,80,380,40,440,80,410,120,350,120,320,80};
setcolor(33 + 3);
drawpoly(6,points2);
setcolor(15 + 29 + 33 + 43 + 44);
outtextxy(140,370,"\\\\\\\\\\============06IT29============///////");
getch();
}
Figure shows that how the program effects have been shown on the screen.
Practical – 04
Language: C.
Usage in C:
Syntax of Ellipse in C:
Ellipse (maxx, maxy, StAngle, EndAngle, xRadius, Yradius);
Program # 1
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
for(yRAD=0;yRAD<100;yRAD+=10)
{
ellipse(xE,yE,stANGLE,endANGLE,xRAD,yRAD);
}
getch();
clrscr();
for(xRAD=0;xRAD<100;xRAD+=10)
{
ellipse(xE,yE,stANGLE,endANGLE,xRAD,yRAD);
}
getch();
Output
Activity # 2
Object: Working with drawpoly (), fillpoly (), setfillstyle ().
Syntax
• fillpoly draws the outline of a polygon using the current line style and color, then fills the
polygon using the current fill pattern and fill color.
• Each pair of integers gives the x and y coordinates of a point on the polygon.
If invalid input is passed to setfillstyle, graphresult returns -11 (grError), and the current fill pattern
and fill color remain unchanged.
Program :
#include<conio.h> rectangle(LEFT,TOP,RIGHT,BOTTOM);
#include<stdio.h> drawpoly(4,RIGHT_para);
#include<graphics.h> drawpoly(5,TOP_para);
Practical – 05
Language: C.
Usage in C
Syntax
Floodfill
Setfillstyle
Setcolor
Program - 1
#include<graphics.h> setfillstyle(4,5);
#include<dos.h> floodfill(350,190,2);
#include<math.h>
void main(void) setfillstyle(5,4);
floodfill(190,121,2);
{
int gd=DETECT,gm; setfillstyle(2,5);
initgraph(&gd,&gm,"C:\\tc\\bgi"); floodfill(370,121,2);
int
star[]={200,200,280,100,360,200,180,120,380
,120,200,200}; setcolor(WHITE);
outtextxy(330,125,"E");
setcolor(2); outtextxy(220,125,"B");
outtextxy(275,110,"A");
drawpoly(7,star); outtextxy(240,160,"C");
outtextxy(310,160,"D");
setfillstyle(1,3);
floodfill(280,130,2); for(int i=1;i<32;i++)
{
setcolor(i);
setfillstyle(2,1); outtextxy(263,135,"QUEST");
floodfill(210,195,2); outtextxy(258,145,"06IT29");
delay(600);
setfillstyle(3,2); }
floodfill(280,110,2); getch();
Figure of program – 1
Program – 2
#include<conio.h> bar(235,40,245,160);
#include<graphics.h> bar(210,160,270,150);
#include<stdio.h>
#include<dos.h> setfillstyle(j-6,j+WHITE+0);
void main(void) bar(290,40,350,50);//T
{ bar(315,40,325,160);
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi"); setfillstyle(j-8,j+BLUE+3);
int y=10; bar(370,40,430,50);//2
/////////////////////////Top Line bar(430,40,420,105);
for(int r=10;r<=629;r+=20) bar(420,105,370,95);
{ bar(370,95,380,160);
setcolor(YELLOW); bar(380,160,430,150);
circle(r,y,10);
setfillstyle(1,RED+r); setfillstyle(j-12,j+BLACK+7);
floodfill(r,y,YELLOW); bar(450,40,510,50);//9
delay(200); bar(450,40,460,105);
} bar(460,105,510,95);
/////////////////////////Left side line bar(510,95,500,40);
for(y=29;y<=469;y+=20) bar(510,105,500,160);
{ bar(500,160,450,150);
setcolor(GREEN); delay(300);
circle(10,y,10); }
setfillstyle(1,y+RED); ////////////////////////////////////////////
floodfill(10,y,GREEN); for(int s=1;s<=360;s++)
delay(200); {
} setcolor(13);
///////////////////////Bottom Line ellipse(319,310,0,s,200,100);
for(r=29;r<=639;r+=20) ellipse(319,310,0,s,180,90);
{ ellipse(319,310,0,s,160,80);
setcolor(GREEN); ellipse(319,310,0,s,140,70);
circle(r,469,10); ellipse(319,310,0,s,120,60);
setfillstyle(1,RED + r -19 ); ellipse(319,310,0,s,210,110);
floodfill(r,468,GREEN); delay(20);
delay(200); }
} ///////////////////////////////////////////
////////////////////////////Right Side Line setcolor(13);
for(y=9;y<=459;y+=20) for(j=0;j<12;j++)
{ {
setcolor(GREEN); setfillstyle(1,j-1);
circle(629,y,10); floodfill(320,415,13);
setfillstyle(1,y+RED);
floodfill(629,y,GREEN); setfillstyle(1,1+j);
delay(200); floodfill(340,405,13);
}
setfillstyle(1,j+6);
///////////////////////////////////// floodfill(360,395,13);
for(int j=1;j<12;j++)
{ setfillstyle(1,RED+j);
setfillstyle(j+1,j+GREEN); floodfill(380,380,13);
bar(40,40,50,160);//Zero
bar(40,40,100,50); setfillstyle(1,j-2);
bar(100,40,110,160); floodfill(400,360,13);
bar(40,160,110,150);
setfillstyle(j,j+RED+0); setfillstyle(1,j);
bar(130,40,140,160);//SIX floodfill(319,310,13);
bar(130,40,190,50); delay(1000);
bar(130,160,190,150); }
bar(190,150,180,100);
bar(180,100,130,110); //////////////////////////////////////
setfillstyle(j-5,j+YELLOW+1); getch();
bar(210,40,270,50);//I }
Practical – 06
Language: C.
Usage in C
The bar3d is a function of graphics.h header file which can simply draw 3D images on the
screen. In this function we give value of x,y points which are for “upper left” and
“bottom right” also we give it 3d values with next values or attributes of it of depth
and height which make this 2D shape 3D. bar3d draws a three-dimensional rectangular bar,
then fills it using the current fill pattern and fill color.
If topflag is non-zero, a top is put on the bar. If topflag is 0, no top is put on the
bar: This makes it possible to stack several bars on top of one another.
To calculate a typical depth for bar3d, take 25% of the width of the bar,
like this:
Syntax
bar3d draws a three-dimensional rectangular bar, then fills it using the
current fill pattern and fill color.
BAR3d
Program 6.0
OUTPUT:
Practical – 07
Language: C.
Usage in C
The bar3d function is can be use to create graphs and charts to show reports, analysis
etc, in a graphical picture .Mostly it is use as a 3-d picture/figure making tool in C
language. But here we are trying to use it as chart making tool. With some changes in the
practice # 6 are make a graph of weekly report earning through bar-3d.
To calculate a typical depth for bar3d, take 25% of the width of the bar,
like this:
Syntax
bar3d draws a three-dimensional rectangular bar, then fills it using the
current fill pattern and fill color.
BAR3d
Program 7.0
/* 29_PR_7.cpp*/ setcolor(LIGHTMAGENTA);
/* generaqtes Bar Chart graph */ outtextxy(270,440,"THU");
#include<stdio.h> outtextxy(280,90,"7300");
#include<conio.h> setcolor(BROWN);
#include<graphics.h> outtextxy(350,440,"FRI");
#define N 6 /* number of values to graph */ outtextxy(360,180,"5200");
#define BWIDTH 30 /* Width of each bar */ setcolor(LIGHTGRAY);
#define SEP 52 /* Separation between bars */ outtextxy(430,440,"SAT");
#define DI (BWIDTH+SEP) /* Distance from bar to bar outtextxy(440,120,"6500");
*/ setcolor(RED);
#define SHFT 15 /* Between border and first outtextxy(480,440,"=>>>WEEKDAYS");
bar */ setcolor(RED);
#define WIDTH ((N+1) * DI) /* Width of CHART*/ setfillstyle(1,LIGHTGREEN);
#define LEFT 5 /* Left side of graph */ rectangle(10,10,575,70);
#define DEPTH 9 /* Depth of the bar */ floodfill(20,20,RED);
#define TOPFLAG 3 /* Put 3d top on bar */ setcolor(BLACK);
#define BOT 430 /* Bottome of Graph */ settextstyle(GOTHIC_FONT,HORIZ_DIR,4
#define TOP 5 /* Top of the graph */ );
#define PPD (float) (BOT-TOP)/100 /* Pixel per data outtextxy(180,15,"3-D");
unit*/ settextstyle(TRIPLEX_FONT,HORIZ_DIR,
void main(void) 4);
{ outtextxy(260,15,"BAR");
int gd=DETECT,gm=CGAC1,error,j;/*Data to display */ outtextxy(340,15,"CHART");
int data[N]={41,47,76,73,52,65}; setcolor(15);
initgraph(&gd,&gm,"c:\\tc\\bgi"); rectangle(480,80,565,420);
rectangle(LEFT,TOP,LEFT+WIDTH,BOT); setfillstyle(1,7);
for(j=0;j<N;j++) /*Draw Bars*/ floodfill(500,100,15);
{ setfillstyle(j+1,1+j%3); setcolor(16);
bar3d(LEFT+SHFT+j*DI,BOT- settextstyle(SANS_SERIF_FONT,VERT_DI
data[j]*PPD,LEFT+SHFT+j*DI+BWIDTH,BOT,DEPTH,TOPFLAG R,3);
); outtextxy(480,300,"06IT29");
} outtextxy(480,220,"QUEST");
outtextxy(480,80,"NAWABSHAH");
setcolor(LIGHTBLUE); setcolor(LIGHTRED);
outtextxy(20,440,"MON"); settextstyle(SANS_SERIF_FONT,VERT_DI
outtextxy(30,220,"4100"); R,6);
setcolor(LIGHTGREEN); outtextxy(500,130,"CG-PR#7");
outtextxy(100,440,"TUE");
outtextxy(110,200,"4700"); getch();
setcolor(LIGHTCYAN); closegraph();
outtextxy(190,440,"WED"); }
outtextxy(200,80,"7600");
OUTPUT:
Practical – 08
Language: C.
POINTERS
Pointers can also be declared as void.Void pointers can't be
dereferenced without explicit casting. This is because the compiler
can't determine the size of the object the pointer points to.
Void *ballbuff
Unsigned (declaration)
A type modifier alters the meaning of the base data type to yield a new
type .Each of these type modifiers can be applied to the base type int.
The modifier unsigned can also be applied to the base type char.
Syntax
void far getimage(int left, int top, int right, int bottom,
void far putimage(int left, int top, void far *bitmap, int op);
Note: The function is given the top left-hand cornor of the area where
image will go, the address in memory holding the image , and an
operator value. The possible values for this operator, as defined in
graphics.h, are:
putimage puts the bit image previously saved with getimage back onto
the
screen, with the upper left corner of the image placed at (left,top).
Argument:What It Is/Does
The first two words of this area are used for the width and height of
the rectangle. The remainder holds the image itself.
Right (left, top) is where putimage places the upper left corner of top
the stored image.
Op: Specifies a combination operator that controls how the color for
each destination pixel onscreen is computed, based on the pixel already
onscreen and the corresponding source pixel in memory.
KBHIT()
Checks for currently available keystrokes
NOTE:
Program # 8.1
/*i m
agecp
. p*/
/* bounci ng bal l created frombi t i mage */ setfi l l styl eS( OLIDF_ ILLC
, G
AC0_LIGHTGREEN);
#i ncl ude<graphi csh
. > ci rcl exyR
( , , AD IUS);
#i ncl ude<coni oh
. > fl oodfi l l (xyC
, , GAC0_LIGHTGREEN);
#i ncl ude<stdi oh
. >
#i ncl ude<m
al l och
. > si ze = i magesi zex
( -RADIUSy , -RADIUSx
, +RADIUSy
, +R ADIUS);
#i ncl ude<dosh
. > bal l buff = (voi d *)mal l oc(si ze); /* get m emory
#defi ne LEFT 0 for i mage */
#defi ne TO
P0 /*
#defi ne R
IGHT 639 pl ace i mage i nto memory */
#defi ne BO
TTOM479 geti magex( -RADIUSy, -
#defi ne R
ADIUS8 RADIUSx, +R ADIUSy, +RADIUSb
, al l buff );
#defi ne C
GAC0_LIGHTGREEN1
dx=2; /* speed of bal l */
voi d mai nvo
( i d) dy=1;
{
cl rscr();
whi l e(!kbhi t ())
i nt gd=DETECTg , m; {
i nt xyd
, , xd
, yo, l dxo
, l dy; /* bal l coordi nates */ puti magex
( -R ADIUSy
, -R
ADIUSb
, al l buff ,C
OPYP
_ UT);
voi d *bal l buff ; /* poi nter to ol dx=x; ol dy=y; /* rem eber where i t was
buffer */ */
unsi gned si ze; /* si ze of
buffer */ x+= dx; y+=dy; /* move i ts coordi nates
*/
i ni tgraph(&gd,&gmc
," :\\tc\\bgi "); /* refl ect i t at edges
*/
rectangl eL
( EFTT
, O
PR
, IGHTB
, O
TTOM); i f (x<=LEFT+RADIUS+2 || x>=RIGHT-RADIUS-2)
x=y=RADIUS+10; dx=-dx;
setcol or(CGAC0_LIGHTGREEN); i f (y<=TOP+RADIUS+1 || y>=BOTTOM-RADIUS-1)
dy=-dy;
puti mageo
( l dx-R
ADIUSo
, l dy-R
ADIUSb
, al l buff ,XO
RP
_ U
T);
del ay(10);
}
cl osegraph(); }
Practical – 09
Language: C.
The SIN functions in C.
For using sin trigonometric function we need COMPLEX.H & MATH.H header files.
DECLARETION
REAL COMPLEX
Real versions
Complex versions
Return Value:
On success,
Figure 9.1: Shows how you can use PIESLICE for making
graphical reports in C language.
Activity # 2
#include<stdio.h> int lx=getmaxx(),ly=getmaxy()/2;
#include<graphics.h> line(0,ly,lx,ly);
#include<conio.h> for(x=0;x<lx;x++)
#include<math.h> { angle=((double)x/lx)*(2*3.142);
#include<dos.h> sinofA=sin(angle);
void main(void) y=ly-ly*sinofA;
{ clrscr(); delay(10);
int gd=DETECT,gm; putpixel(x,y,x);
double angle,sinofA; setcolor(x);
int x,y; outtextxy(x+20,y,"06IT29"); }
initgraph(&gd,&gm,"c:\\tc\\bgi"); getch(); }
Figure 9.2: shows how you can draw a sinusoidal wave with
help of sine function and putpixel.
Practical – 10
Object: How to create a shape with user defined
function and replicate it on whole screen?
Language: C.
moveto
moveto moves the CP to (x, y)
Syntax:
void far moveto(int x, int y);
Syntax:
void far linerel(int dx, int dy);
Program : 10.1
#include<graphics.h> moveto(x,y); outtextxy(x+64,y+5,"Syed Salman
#include<stdio.h> square(SIDE); Mehdi");
#include<conio.h> setcolor(15); setcolor(BLACK);
#define MAX 640 setfillstyle(1,LIGHTGREEN); settextstyle(2,0,3);
#define GRID 80 floodfill(x+10,y+5,15); outtextxy(x+3,y+62,"QUEST
#define SIDE 72 setcolor(BROWN); NAWABSHAH");
void square(int side); settextstyle(2,1,2); setcolor(BLUE+RED);
void main(void) outtextxy(x+4,y+22,"06IT29"); settextstyle(2,0,6);
{int gd=DETECT,gm; setcolor(LIGHTRED); outtextxy(x+15,y+20,"PR-10");}
int x,y; settextstyle(2,0,3); getche();}
initgraph(&gd,&gm,"c:\\tc\\bgi"); outtextxy(x+2,y+2,"Computer void square(int side)
for(y=0; y<MAX; y+=GRID) Graphics"); {linerel(side,0);
for(x=0;x<MAX;x+=GRID) setcolor(LIGHTBLUE); linerel(0,side);
{setcolor(15); settextstyle(2,1,2); linerel(-side,0);
linerel(0,-side);}
Fig10.2 :Filling the boxes with flood fill and writing text on them.
Practical – 11
Object: Rotation in graphical pictures with some conditional codes.
Language: C.
Fig: 11.2 shows the program first get the input user then show the rotation on the wedge.
#include<stdio.h> outtextxy(xc-36,yc,"-<06IT29>-");}
#include<conio.h> void main()
#include<graphics.h> { int d=0,m=0,x;
#include<math.h> int y1=240;
#define PI 3.1415 initgraph(&d,&m,"c:\\tc\\bgi");
#include<dos.h> while(!kbhit())
void rotate_wheel(int xc,int yc,int t) { for(x=0;x<640;x++)
{ int x,y; { rotate_wheel(x,y1,x%60);
for(t=t;t<180;t=t+60) sound(6*x);
{ setcolor(RED); delay(6);
x=50*cos(t*PI/180); nosound();
y=50*sin(t*PI/180); cleardevice();
line(xc+x,yc+y,xc-x,yc-y); rotate_wheel(x,240,x%60);}
//bar(xc+x,yc+y,xc-x,yc-y);} if(x>=639)
setcolor(LIGHTBLUE); { x=0;} }
circle(xc,yc,50); getch();
circle(xc,yc,53); closegraph();}
setcolor(YELLOW);
Fig: 11.3 shows how a circle shown on the screen, which from left to right
till any key press.
Practical – 12
Object: How put text on screen in graphical mode with varieties?
Language: C.
Activity#1 : Draw Text Wider,Taller , normal & mix style on the screen.
Fig 12.1 , shows how you can draw text in different varieties .
Fig: 12.2 shows how you can draw text in vertical and horizontal direction.
Fig: 12.3 shows how you can justify text in different position of the screen.
Language: C.
06 IT 29/33/43/44/tb-03 1
Computer Graphics Project
With respect of Sir. Mukhtiar Ahmed Kori
Starting of the Project.
06 IT 29/33/43/44/tb-03 2
Computer Graphics Project
With respect of Sir. Mukhtiar Ahmed Kori
The figure shows after hitting all ten hits, screen will look this and
the points which you scored are shown below on left-bottom
position.
06 IT 29/33/43/44/tb-03 3
Computer Graphics Project
With respect of Sir. Mukhtiar Ahmed Kori
06 IT 29/33/43/44/tb-03 4
Computer Graphics Project
With respect of Sir. Mukhtiar Ahmed Kori
/* for centering text messages fillpoly(9,poly);} 50,z,20,20);
*/ else line(39,3,39,47);
settextjustify(CENTER_TEXT, {for(i=5,z=k;i<x||z>0;z-- line(50,24,50,26);
CENTER_TEXT); ,i=i+5) i=5;
x = getmaxx();// / 2; {//if(z==0) poly[0]=i+2;
y = getmaxy();// / 2; //break; poly[1]=n+25;
setbkcolor(9); if(j<35) poly[2]=i;
getch(); {setcolor(14); poly[3]=n+24;
/*score board*/ line(j,25,39,3); poly[4]=i+55;
setcolor(16); line(j,25,39,47);} poly[5]=n+24;
rectangle(5,y-55,105,y-5); if(j==35) poly[6]=i+50;
setcolor(10); { setcolor(14); poly[7]=n+20;
rectangle(8,y-52,102,y-8); line(39,3,39,47); poly[8]=i+60;
setcolor(14); line(50,24,50,26);} poly[9]=n+25;
settextstyle(1,0,1); setcolor(4); poly[10]=i+50;
outtextxy(55,y-45,"POINTS"); setfillstyle(1,4); poly[11]=n+30;
setcolor(12); //m=0; poly[12]=i+55;
/*name*/ poly[0]=i+2; poly[13]=n+26;
setcolor(LIGHTRED); poly[1]=25; poly[14]=i;
settextstyle(2,0,4); poly[2]=i; poly[15]=n+26;
outtextxy(x/2,y-10,"Re-Edited poly[3]=24; poly[16]=i+2;
By: Syed Salman Mehdi poly[4]=i+55; poly[17]=n+25;
(06IT29)"); poly[5]=24; delay(10);
setcolor(12); poly[6]=i+50; fillpoly(9,poly);
while(ans=='y') poly[7]=20; n=n-25;
{/*bow*/ poly[8]=i+60; b--;
j=5; poly[9]=25; fflush(stdin);
i=5; poly[10]=i+50; getch();
setcolor(14); poly[11]=30; }//end of 1 game
arc(5,25,315,45,45); poly[12]=i+55; setcolor(14);
line(5,25,39,3); poly[13]=26; line(39,3,39,47);
line(5,25,39,47); poly[14]=i; line(50,24,50,26);
setcolor(9); setcolor(14);
line(39,3,39,47); settextstyle(2,0,4);
line(50,24,50,26); outtextxy(x/2,y/2,"Play
a=0; m=0; n=225; s=0; Again y/n");
for(p=5;p<65;p=p+5) ans=getch();
{erase(p);} setcolor(9);
while(a<10) settextstyle(2,0,4);
{ poly[0]=i+2; poly[1]=m+25; outtextxy(x/2,y/2,"Play
poly[2]=i; poly[3]=m+24; Again y/n"); }
poly[4]=i+55; poly[5]=m+24; //clean up
poly[6]=i+50; poly[7]=m+20; getch();
poly[8]=i+60; poly[9]=m+25; restorecrtmode();
poly[10]=i+50; poly[11]=m+30; closegraph();}
poly[12]=i+55;
06 IT 29/33/43/44/tb-03 5