CG File

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 54

Malout Instiitute of

management and information


technology

Name: Shruti Sharma

Class: BCA 3RD YEAR ‘B’

Roll no.:- 1246

Subject: Computer Graphics

Submitted to: Ms. Navdeep Lata

Remarks:
INDEX

i. Use of basic functions of graphic available like circle,

putpixel, rectangle, arc, ellipse, floodfill, setcolor etc

ii. Design a logo/poster using primitive functions.

iii. Draw a 3 D object using palettes.

iv. Line Drawing Algorithm : Direct method and DDA

v. Bresenham’s Line Drawing Algorithm

vi. Circle Generating Algorithm : Equation and trigonometric

function.

vii. Bresenham’s Circle Generating Algorithm

viii. Draw an ellipse using Midpoint Algorithm.

ix. Translation transformation on a polygon.

x. Scaling transformation on a polygon.

xi. Rotation transformation on a polygon.

xii. Reflection transformation on a polygon.


xiii. Shearing transformation on a polygon.

xiv. Mixed transformation on an object .

xv. Minor project (eg Game/ Animation etc.)


Program: Use of basic functions of graphic available like circle,

putpixel, rectangle, arc, ellipse, floodfill, setcolor etc

Code:-

#include<graphics.h>

#include<conio.h>

void main()

intgd=DETECT,gm;

initgraph (&gd,&gm,"c:\\tc\\bgi");

setbkcolor(GREEN);

printf("\t\t\t\n\nLINE");

line(50,40,190,40);

printf("\t\t\n\n\n\nRECTANGLE");

rectangle(125,115,215,165);

printf("\t\t\t\n\n\n\n\n\n\nARC");

arc(120,200,180,0,30);
printf("\t\n\n\n\nCIRCLE");

circle(120,270,30);

printf("\t\n\n\n\nECLIPSE");

ellipse(120,350,0,360,30,20);

getch();

Output
Program: Design a logo/poster using primitive functions.

Code:-

#include <conio.h>

#include <graphics.h>

#include <stdio.h>

void main()

int gd = DETECT, gm;

initgraph(&gd, &gm, "C:\\turboc3\\bgi");

setfillstyle(SOLID_FILL, DARKGRAY);

floodfill(50, 50, 15);

setfillstyle(SOLID_FILL, BLUE);

circle(300, 300, 100);

circle(300, 300, 90);

floodfill(202, 300, 15);

setfillstyle(SOLID_FILL, YELLOW);

circle(400, 400, 100);


circle(400, 400, 90);

floodfill(322, 350, 15);

floodfill(302, 400, 15);

setfillstyle(SOLID_FILL, BLACK);

circle(520, 300, 100);

circle(520, 300, 90);

floodfill(442, 350, 15);

floodfill(422, 300, 15);

setfillstyle(SOLID_FILL, GREEN);

circle(620, 400, 100);

circle(620, 400, 90);

floodfill(522, 400, 15);

floodfill(542, 350, 15);

setfillstyle(SOLID_FILL, RED);

circle(740, 300, 100);

circle(740, 300, 90);

floodfill(642, 300, 15);


floodfill(662, 350, 15);

getch();

closegraph();

Output:
Program: Draw a 3 D object using palettes.

#include <graphics.h>

int main()

int gd = DETECT, gm;

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

int left, top, right, bottom;

int depth;

int topflag;

bar3d(left = 150, top = 250,

right = 190, bottom = 350,

depth = 20, topflag = 1);

bar3d(left = 220, top = 150,

right = 260, bottom = 350,

depth = 20, topflag = 0);


bar3d(left = 290, top = 200,

right = 330, bottom = 350,

depth = 20, topflag = 1);

line(100, 50, 100, 350);

line(100, 350, 400, 350);

getch();

closegraph();

return 0;

Output:
Program: Line Drawing Algorithm : Direct method and DDA

#include <graphics.h>

#include <math.h>

#include <stdio.h>

int abs(int n) { return ((n > 0) ? n : (n * (-1))); }

void DDA(int X0, int Y0, int X1, int Y1)

int dx = X1 - X0;

int dy = Y1 - Y0;

int steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy);

float Xinc = dx / (float)steps;

float Yinc = dy / (float)steps;

float X = X0;

float Y = Y0;

for (int i = 0; i <= steps; i++) {

putpixel(round(X), round(Y),

RED); // put pixel at (X,Y)


X += Xinc; // increment in x at each step

Y += Yinc; // increment in y at each step

delay(100); // for visualization of line-

int main()

int gd = DETECT, gm;

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

int X0 = 2, Y0 = 2, X1 = 14, Y1 = 16;

DDA(2, 2, 14, 16);

return 0;

OUTPUT:

200 180
199 179

198 178

197 177

196 176

195 175

194 174

193 173

192 172

191 171

190 170

189 169

188 168

187 167

186 166

185 165

184 164

183 163
Program: Bresenham’s Line Drawing Algorithm

#include <bits/stdc++.h>

using namespace std;

void bresenham(int x1, int y1, int x2, int y2)

int m_new = 2 * (y2 - y1);

int slope_error_new = m_new - (x2 - x1);

for (int x = x1, y = y1; x <= x2; x++) {

cout << "(" << x << "," << y <<")\n";

slope_error_new += m_new;

if (slope_error_new >= 0) {

y++;

slope_error_new -= 2 * (x2 - x1);

}
int main()

int x1 = 3, y1 = 2, x2 = 15, y2 = 5;

bresenham(x1, y1, x2, y2);

return 0;

OUTPUT:
Program: Circle Generating Algorithm : Equation and

trigonometric function.

#include <graphics.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
# define pi 3.14

class bresen
{
float a, b, h, k, thetaend,step,x,y;
int i;
public:
void get ();
void cal ();
};
void main ()
{
bresen b;
b.get ();
b.cal ();
getch ();
}
void bresen :: get ()
{
cout<<"\n ENTER CENTER OF ELLIPSE";
cin>>h>>k;
cout<<"\n ENTER LENGTH OF MAJOR AND MINOR AXIS";
cin>>a>>b;
cout<<"\n ENTER STEP SIZE";
cin>> step;
}
void bresen ::cal ()
{

int gdriver = DETECT,gmode, errorcode;


int midx, midy, i;
initgraph (&gdriver, &gmode, " ");
errorcode = graphresult (); if (errorcode ! = grOK)
{
printf("Graphics error: %s \n", grapherrormsg (errorcode);
printf ("Press any key to halt:");
getch ();
exit (1); }
theta= 0;
thetaend=(pi*90)/180;
whilex (theta<thetaend)
{
x = a * cos (theta);
y = b * sin (theta);
putpixel (x+h, y+k, RED);
putpixel (-x+h, y+k, RED);
putpixel (-x+h, -y+k, RED);
putpixel (x+h, -y+k, RED);
theta+=step;
}
getch();
}

Output:

Program: Bresenham's Circle Drawing Example Program


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main() {
int gd = DETECT, gm;
int x, y, r;
void cir(int, int, int);
printf("Enter the Mid points and Radious:");
scanf("%d%d%d", &x, &y, &r);
initgraph(&gd, &gm, "");
cir(x, y, r);
getch();
closegraph();
}
void cir(int x1, int y1, int r) {

int x = 0, y = r, p = 1 - r;

void cliplot(int, int, int, int);

cliplot(x1, y1, x, y);

while (x < y) {

x++;

if (p < 0)

p += 2 * x + 1;

else {

y--;

p += 2 * (x - y) + 1;

cliplot(x1, y1, x, y);

void cliplot(int xctr, int yctr, int x, int y) {

putpixel(xctr + x, yctr + y, 1);

putpixel(xctr - x, yctr + y, 1);


putpixel(xctr + x, yctr - y, 1);

putpixel(xctr - x, yctr - y, 1);

putpixel(xctr + y, yctr + x, 1);

putpixel(xctr - y, yctr + x, 1);

putpixel(xctr + y, yctr - x, 1);

putpixel(xctr - y, yctr - x, 1);

getch();

Output:

Program: Ellipse using Midpoint algorithm

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void ellipse(int xc,int yc,int rx,int ry)
{
int gm=DETECT,gd;
int x, y, p;
clrscr();
initgraph(&gm,&gd,"C:\\TC\\BGI");
x=0;
y=ry;
p=(ry*ry)-(rx*rx*ry)+((rx*rx)/4);
while((2*x*ry*ry)<(2*y*rx*rx))
{
putpixel(xc+x,yc-y,WHITE);
putpixel(xc-x,yc+y,WHITE);
putpixel(xc+x,yc+y,WHITE);
putpixel(xc-x,yc-y,WHITE);

if(p<0)
{
x=x+1;
p=p+(2*ry*ry*x)+(ry*ry);
}
else
{
x=x+1;
y=y-1;
p=p+(2*ry*ry*x+ry*ry)-(2*rx*rx*y);
}
}
p=((float)x+0.5)((float)x+0.5)*ry*ry+(y-1)(y-1)*rx*rx-rx*rx*ry*ry;

while(y>=0)
{
putpixel(xc+x,yc-y,WHITE
putpixel(xc-x,yc+y,WHITE);
putpixel(xc+x,yc+y,WHITE);
putpixel(xc-x,yc-y,WHITE);

if(p>0)
{
y=y-1;
p=p-(2*rx*rx*y)+(rx*rx);

}
else
{
y=y-1;
x=x+1;
p=p+(2*ry*ry*x)-(2*rx*rx*y)-(rx*rx);
}
}
getch();
closegraph();
}

void main()
{
int xc,yc,rx,ry;
clrscr();
printf("Enter Xc=");
scanf("%d",&xc);
printf("Enter Yc=");
scanf("%d",&yc);
printf("Enter Rx=");
scanf("%d",&rx);
printf("Enter Ry=");
scanf("%d",&ry);
ellipse(xc,yc,rx,ry);
getch();
}

OUTPUT:
(50.000000, 65.000000)
(50.000000, 65.000000)
(50.000000, 35.000000)
(50.000000, 35.000000)
(51.000000, 65.000000)
(49.000000, 65.000000)
(51.000000, 35.000000)
(49.000000, 35.000000)
(52.000000, 65.000000)
(48.000000, 65.000000)
(52.000000, 35.000000)
(48.000000, 35.000000)
(53.000000, 64.000000)
(47.000000, 64.000000)
(53.000000, 36.000000)
(47.000000, 36.000000)
(54.000000, 64.000000)
(46.000000, 64.000000)
(54.000000, 36.000000)
(46.000000, 36.000000)
(55.000000, 63.000000)
(45.000000, 63.000000)
(55.000000, 37.000000)
(45.000000, 37.000000)
(56.000000, 62.000000)
(44.000000, 62.000000)
(56.000000, 38.000000)
(44.000000, 38.000000)
(57.000000, 61.000000)
(43.000000, 61.000000)
(57.000000, 39.000000)
(43.000000, 39.000000)
(57.000000, 60.000000)
(43.000000, 60.000000)
(57.000000, 40.000000)
(43.000000, 40.000000)
(58.000000, 59.000000)
(42.000000, 59.000000)
(58.000000, 41.000000)
(42.000000, 41.000000)
(58.000000, 58.000000)
(42.000000, 58.000000)

PROGRAM: 2D Transformations (POLYGON)


#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
#include<dos.h>
struct wct
{
int x;
int y;
};
typedef double matrix[3][3];
matrix thm;

void setid(matrix m)
{
int i,j;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
m[i][j]=(i=j);
}
void premul(matrix a)
{
matrix tmp;
int r,c;
for(r=0;r<3;r++)
for(c=0;c<3;c++)
tmp[r][c]=thm[r][0]*a[0][c]+thm[r][1]*a[1][c]+thm[r][2]*a[2][c];
for(r=0;r<3;r++)
for(c=0;c<3;c++)
thm[r][c]=tmp[r][c];
}
void transform(int n,wct *pt)
{
int i;
double tmp;
for(i=0;i<n;i++)>
{
tmp=thm[0][0]*pt[i].x+thm[0][1]*pt[i].y+thm[0][2];
pt[i].y=thm[1][0]*pt[i].x+thm[1][1]*pt[i].y+thm[1][2];
pt[i].x=tmp;
}
}
void translation(int tx,int ty)
{
matrix m;
setid(m);
m[0][2]=tx;
m[1][2]=ty;
premul(m);
}
void rotation(double a,wct pt)
{
matrix m;
a=(22*a)/1260;
setid(m);
m[0][0]=cos(a);
m[0][1]=sin(a);
m[0][2]=pt.x*(1-cos(a))-pt.x*sin(a);
m[1][0]=sin(a);
m[1][1]=cos(a);
m[1][2]=pt.y*(1-cos(a))-pt.x*sin(a);
premul(m);
}
void scaling(int sx,int sy,wct pt)
{
matrix m;
setid(m);
m[0][0]=sx;
m[0][1]=pt.x*(1-sx);
m[1][1]=sy;
m[1][2]=pt.y*(1-sy);
premul(m);
}
void usrpoly(wct *pt,int n)
{
int i,j=0;
int *a;
for(i=0;i<n;i++)>
{
a[j]=pt[i].x;
a[j+1]=pt[i].y;
j+=2;
}
j-=2;
a[j]=a[0];
a[j+1]=a[1];
drawpoly(n,a);
}
void main()
{
int gd,gm,i,j;
void translate(wct *,int);
void rotate(wct *,int);
void scale(wct *,int);
void translation(int,int);
wct pt[]={200,200,400,200,400,300,200,300,200,200};
int tx,ty;
int c;
do
{
clrscr();
printf("\n\t--------------------------- ");
printf("\n\t 2d transformations(Polygon)");
printf("\n\t--------------------------- ");
printf("\n\t 1.Translation ");
printf("\n\t 2.Rotation ");
printf("\n\t 3.Scaling ");
printf("\n\t 4.Exit ");
printf("\n\t Enter your choice:");
scanf("%d",&c);
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"C:\\TC\\BGI");
switch(c)
{
case 1: translate(pt,6);getch();break;
case 2: rotate(pt,6);getch();break;
case 3: scale(pt,6);getch();break;
case 4: printf("\n\t\t Exit from the menu"); getch();break;
default: printf("\n\t\t invalid choice........!");break;
}
getch();
closegraph();
}while(c!=4);
}
void translate(wct *pt,int n)
{
int x,y;
setid(thm);
cleardevice();
usrpoly(pt,n);
printf("\t\t Enter point to translate (x,y):");
scanf("%d%d",&x,&y);
translation(x,y);
transform(n,pt);
usrpoly(pt,n);
}
void rotate(wct *pt,int n)
{
double ang;
wct rpt;
setid(thm);
usrpoly(pt,n);
printf("\t\t Enter the angle to rotate");
scanf("%f",&ang);
printf("Enter the reference point(x,y)");
scanf("%d%d",&rpt.x,&rpt.y);
rotation(ang,rpt);
transform(n,pt);
usrpoly(pt,n);
}
void scale(wct *pt,int n)
{
double ang;
int sx,sy;
wct rpt;
setid(thm);
usrpoly(pt,n);
printf("\n\t Enter scaling factor (sx,sy)");
scanf("%d%d",&sx,&sy);
printf("Enter the reference point (x,y)");
scanf("%d%d",&rpt.x,&rpt.y);
scaling(sx,sy,rpt);
transform(n,pt);
usrpoly(pt,n);
}

Output:
PROGRAM: C program for the reflection transformation on an
object .
#include <conio.h>
#include <graphics.h>
#include <stdio.h>

// Driver Code
void main()
{
// Initialize the drivers
int gm, gd = DETECT, ax, x1 = 100;
int x2 = 100, x3 = 200, y1 = 100;
int y2 = 200, y3 = 100;

// Add in your BGI folder path


// like below initgraph(&gd, &gm,
// "C:\\TURBOC3\\BGI");
initgraph(&gd, &gm, "");
cleardevice();

// Draw the graph


line(getmaxx() / 2, 0, getmaxx() / 2,
getmaxy());
line(0, getmaxy() / 2, getmaxx(),
getmaxy() / 2);
// Object initially at 2nd quadrant
printf("Before Reflection Object"
" in 2nd Quadrant");

// Set the color


// Set the color
setcolor(14);
line(x1, y1, x2, y2);
line(x2, y2, x3, y3);
line(x3, y3, x1, y1);
getch();

// After reflection
printf("\nAfter Reflection");

// Reflection along origin i.e.,


// in 4th quadrant
setcolor(4);
line(getmaxx() - x1, getmaxy() - y1,
getmaxx() - x2, getmaxy() - y2);

line(getmaxx() - x2, getmaxy() - y2,


getmaxx() - x3, getmaxy() - y3);

line(getmaxx() - x3, getmaxy() - y3,


getmaxx() - x1, getmaxy() - y1);

// Reflection along x-axis i.e.,


// in 1st quadrant
setcolor(3);
line(getmaxx() - x1, y1,
getmaxx() - x2, y2);
line(getmaxx() - x2, y2,
getmaxx() - x3, y3);
line(getmaxx() - x3, y3,
getmaxx() - x1, y1);

// Reflection along y-axis i.e.,


// in 3rd quadrant
setcolor(2);
line(x1, getmaxy() - y1, x2,
getmaxy() - y2);
line(x2, getmaxy() - y2, x3,
getmaxy() - y3);
line(x3, getmaxy() - y3, x1,
getmaxy() - y1);
getch();
// Close the graphics
closegraph();
}

OUTPUT:
PROGRAM: Shearing Transformation on an object
#include<stdio.h>
#include<graphics.h>
#include<math.h>
int graDriver=DETECT,graMode;
int n,xs[100],ys[100],i;
float shearXfactor,shearYfactor;

void DrawFn()
{
for(i=0;i<n;i++)
line(xs[i],ys[i],xs[(i+1)%n],ys[(i+1)%n]);
}

void shearAlongX()
{
for(i=0;i<n;i++)
xs[i]=xs[i]+shearXfactor*ys[i];
}

void shearAlongY()
{
for(i=0;i<n;i++)
ys[i]=ys[i]+shearYfactor*xs[i];
}

void main()
{
printf("Enter number of sides: ");
scanf("%d",&n);
printf("Enter co-rdinates: x,y for each point ");
for(i=0;i<n;i++)
scanf("%d%d",&xs[i],&ys[i]);
printf("Enter x shear factor:");
scanf("%f",&shearXfactor);
printf("Enter y shear factor:");
scanf("%f",&shearYfactor);

initgraph(&graDriver,&graMode,"C:\\TURBOC3\\BGI\\");
setcolor(RED);
DrawFn();//original
shearAlongX();
setcolor(BLUE);
DrawFn();//Xshear
shearAlongY();
setcolor(GREEN);
DrawFn();//Yshear
getch();

OUTPUT:
Program: Mixed Transformations in polygons

#include<graphics.h>

#include<iostream.h>

#include<conio.h>

#include<math.h>

float x1,y1,x2,y2,x3,y3,x,y.rx1.ryl.rx2.ry2.rx3.ry3.rx.ry.tw1-5.w2-5,w3-635,w4-465,v1-425,

v2-75,v3-550.v4-250;

int gd.gm.i

void triangle (float, float, float, float, float, float);

void rotate (float, float,float):

void main()

clrscr():

cout<<"\n\t\t*** Composite 2D Transformations****

cout<<"\n\nEnter the coordinates of triangle (x1,y1,x2,y2,x3,y3)":

cin>>x1>>yl>>x2>>y2>>x3>>y3:

initgraph(&gd.&gm, "C:\\TC\\BGI");

triangle (x1,y1.x2,y2.x3,y3);

closegraph():

cout<<"\n\nEnter the Shear Value: \\t":

cin>>x;

initgraph(&gd.&gm, "C:\\TC\\BGI"); triangle(x1,y1.x2,y2,x3,y3):

x2-x2+x:
triangle(x1,y1.x2,y2.x3,y3):

closegraph():

cout<<"\n\nEnter the angle of rotation: \t\t";

cin>>t; cout<<"\nEnter the reference point of rotation (rx.ry): \t":

cin>>rx>>ry:

initgraph(&gd.&gm, "C:\\TC\\BGI");

triangle (x1,y1,x2,y2,x3,y3):

rotate(t.rx.ry): closegraph():

cout<<"\n\nEnter the translation factors (x,y): \t\t";

cin>>x>>y;

initgraph(&gd.&gm, "C:\\TC\\BGI): triangle (x1,y1,x2,y2,x3,y3);

x1=x1+x; yl-yl+y:

x2-x2+x: y2-y2+y:

x3=x3+x;

y3=y3+y:

triangle(x1,y1,x2,y2.x3,y3):

closegraph():

initgraph(&gd.&gm, "C:\\TC\\BGI");

triangle (x1,y1,x2,y2,x3,y3);

rotate (180,x2,y2):

closegraph();

cout<<"\n\nEnter the scaling factors (x,y): \t\t":

cin>>x>>y;
initgraph(&gd.&gm, "C:\\TC\\BGI"); triangle (x1,y1,x2,y2,x3,y3);

xl=xl*x; yl=yly:

x2=x2*x;

v2-y2y: x3-x3"x:

y3-y3y:

triangle(x1,y1,x2,y2.x3,y3):

closegraph():

initgraph(&gd.&gm, "C:\\TC\\BGI");

rectangle(wl.w2.w3.w4);

outtextxy(300,10. "Window Port");

triangle(x1,y1,x2,y2,x3,y3): x=(v3-v1)/(w3-w1),

y=(v4-v2)/(w4-w2);

x1-v1+floor(((x1-w1)*x)+0.5); y1-v2+floor(((y1-w2)*y)+0.5);

x2-v1+loог(((x2-w1)*x)+0.5);
void triangle(float x1, float y1. float x2, float y2, float x3, float y3)

line(x1,y1,x2,y2): line(x2,y2,x3,y3);
line(x3,y3,x1,y1);

getch();

void rotate(float t,float rx, float ry)

t-t (3,14/180); rxl-rx+(x1-x)*cos(t)-(yl-ry) *sin(t): ryl-ry+(x1-rx)*sin(t)+(y1-ry)*cos(t); rx2=rx+


(x2-rx)*cos(t)-(y2-ry) *sin(t): ry2=ry+(x2-rx)*sin(t)+(y2-ry) *cos(t); rx3=rx+(x3-rx)*cos(t)-(y3-
ry)*sin(t); ry3-ry+(x3-rx)*sin(t)+(y3-ry)*cos(t); xl-rxl:

yl=ryl; x2-rx2:

y2-ry2: x3-rx3:

y3=ry3;
triangle(x1,y1,x2,y2,x3,y3);
}

OUTPUT:

PROGRAM: MINOR PROJECT IN COMPUTER GRAPHICS

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
int i=0,j=300,m=0,k=0,maxx,maxy,arrows=0,ll,snd=0;
double score=0;
char a[4];

gameover()
{
setcolor(0);
setfillstyle(SOLID_FILL,0);
bar(11,11,maxx-11,maxy-11);
setcolor(BROWN);
setfillstyle(SOLID_FILL,1);
bar(maxx/2-100,maxy/2-50,maxx/2+100,maxy/2+50);
outtextxy(maxx/2-50,maxy/2-20,"Game Over..!");
outtextxy(maxx/2-70,maxy/2,"Your score is:");
outtextxy(maxx/2-200,maxy/2+90,"Press `Space Bar' to Contuinue and `Esc' to Exit.");
gcvt(score,4,a);
outtextxy(maxx/2+60,maxy/2,a);
if(getch()==32)
{
arrows=0;
score=0;
main();
}
closegraph();
clrscr();
exit(0);
return 0;
}

stick1(loc)
{
snd=0;
setcolor(0);
gcvt(score,4,a);
outtextxy(330,40,a);

setcolor(LIGHTGRAY);
if(loc>=130 && loc<=140)
{
score=score+100;
outtextxy(250,60,"Points: 100");
}
if(loc>=120 && loc<130)
{
score=score+70;
outtextxy(250,60,"Points: 70");
}
if(loc>140 && loc<=150)
{
score=score+70;
outtextxy(250,60,"Points: 70");
}
if(loc>=110 && loc<120)
{
score=score+50;
outtextxy(250,60,"Points: 50");
}
if(loc>150 && loc<=160)
{
score=score+50;
outtextxy(250,60,"Points: 50");
}
if(loc>=100 && loc<110)
{
score=score+40;
outtextxy(250,60,"Points: 40");
}
if(loc>160 && loc<=170)
{
score=score+40;
outtextxy(250,60,"Points: 40");
}
if(loc>=90 && loc<100)
{
score=score+35;
outtextxy(250,60,"Points: 35");
}
if(loc>170 && loc<=180)
{
score=score+35;
outtextxy(250,60,"Points: 35");
}

outtextxy(230,40,"Total Score:");
gcvt(score,4,a);
outtextxy(330,40,a);

for(i=i;i<300;i++)
{
snd=snd+1;
setfillstyle(1,8);
setcolor(2);
bar(20,20+i,25,110+i);
setfillstyle(1,7);
bar(27,30+i,30,100+i);
setfillstyle(1,9);
bar(32,40+i,35,90+i);
setfillstyle(1,14);
bar(37,50+i,40,80+i);
setfillstyle(1,4);
bar(42,60+i,45,70+i);

setcolor(BROWN);

if(loc>=130 && loc<=140)


{
line(46,i-loc+200,66,i-loc+200);
if(snd==1)
sound(1500);
if(snd==3)
nosound();
if(snd==5)
sound(1500);
if(snd==15)
nosound();
}
if(loc>=120 && loc<130)
{
line(41,i-loc+200,61,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==15)
nosound();
}
if(loc>140 && loc<=150)
{
line(41,i-loc+200,61,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==15)
nosound();
}
if(loc>=110 && loc<120)
{
line(36,i-loc+200,56,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==20)
nosound();
}
if(loc>150 && loc<=160)
{
line(36,i-loc+200,56,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==20)
nosound();
}
if(loc>=100 && loc<110)
{
line(31,i-loc+200,51,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==15)
sound(800);
if(snd==20)
nosound();
}
if(loc>160 && loc<=170)
{
line(31,i-loc+200,51,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==15)
sound(800);
if(snd==20)
nosound();
}
if(loc>=90 && loc<100)
{
line(26,i-loc+200,46,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==15)
sound(800);
if(snd==20)
sound(700);
if(snd==25)
nosound();
}
if(loc>170 && loc<=180)
{
line(26,i-loc+200,46,i-loc+200);
if(snd==1)
sound(1300);
if(snd==5)
sound(1100);
if(snd==10)
sound(900);
if(snd==15)
sound(800);
if(snd==20)
sound(700);
if(snd==25)
nosound();
}

delay(20);
setcolor(0);
setfillstyle(SOLID_FILL,0);
bar(20,20+i,25,110+i);
bar(27,30+i,30,100+i);
bar(32,40+i,35,90+i);
bar(37,50+i,40,80+i);
bar(42,60+i,45,70+i);

if(loc>=130 && loc<=140)


line(46,i-loc+200,66,i-loc+200);
if(loc>=120 && loc<130)
line(41,i-loc+200,61,i-loc+200);
if(loc>140 && loc<=150)
line(41,i-loc+200,61,i-loc+200);
if(loc>=110 && loc<120)
line(36,i-loc+200,56,i-loc+200);
if(loc>150 && loc<=160)
line(36,i-loc+200,56,i-loc+200);
if(loc>=100 && loc<110)
line(31,i-loc+200,51,i-loc+200);
if(loc>160 && loc<=170)
line(31,i-loc+200,51,i-loc+200);
if(loc>=90 && loc<100)
line(26,i-loc+200,46,i-loc+200);
if(loc>170 && loc<=180)
line(26,i-loc+200,46,i-loc+200);

if(kbhit())
{
int ch=getch();
if(ch==27)
{
closegraph();
exit(0);
}
}
}
i=0;j=300;k=0;

setcolor(0);
if(loc>=130 && loc<=140)
outtextxy(250,60,"Points: 100");
if(loc>=120 && loc<130)
outtextxy(250,60,"Points: 70");
if(loc>140 && loc<=150)
outtextxy(250,60,"Points: 70");
if(loc>=110 && loc<120)
outtextxy(250,60,"Points: 50");
if(loc>150 && loc<=160)
outtextxy(250,60,"Points: 50");
if(loc>=100 && loc<110)
outtextxy(250,60,"Points: 40");
if(loc>160 && loc<=170)
outtextxy(250,60,"Points: 40");
if(loc>=90 && loc<100)
outtextxy(250,60,"Points: 35");
if(loc>170 && loc<=180)
outtextxy(250,60,"Points: 35");
if(arrows==10)
{
gameover();
}
dartboard();
return 0;
}

shoot()
{
if(arrows==10)
{
gameover();
}
arrows=arrows+1;
setcolor(0);
for(ll=15;ll<=15*arrows;ll+=15)
{
outtextxy(550,40+ll,"_______");
outtextxy(600,44+ll,"<");
}
a:
for(i=i;i<300;i++)
{
if(k==350 && i>=110 && i<=160)
{
int loc=i;
stick1(loc);
}
if(k==360 && i>=90 && i<=110)
{
int loc=i;
stick1(loc);
}
if(k==360 && i>=160 && i<180)
{
int loc=i;
stick1(loc);
}

if(k==400)
{
k=0;
dartboard();
}
k=k+10;
setfillstyle(1,8);
setcolor(2);
bar(20,20+i,25,110+i);
setfillstyle(1,7);
bar(27,30+i,30,100+i);
setfillstyle(1,9);
bar(32,40+i,35,90+i);
setfillstyle(1,14);
bar(37,50+i,40,80+i);
setfillstyle(1,4);
bar(42,60+i,45,70+i);
line(400-k,200,420-k,200);

delay(20);
setcolor(0);
setfillstyle(SOLID_FILL,0);
bar(20,20+i,25,110+i);
bar(27,30+i,30,100+i);
bar(32,40+i,35,90+i);
bar(37,50+i,40,80+i);
bar(42,60+i,45,70+i);

line(400-k,200,420-k,200);

if(kbhit())
{
int ch=getch();
if(ch==27)
{
closegraph();
exit(0);
}
}
}
i=0;j=300;
if(arrows==10)
{
gameover();
}
goto a;
}

dartboard()
{
a:
for(i=i;i<300;i++)
{
setfillstyle(1,8);
bar(20,20+i,25,110+i);
setfillstyle(1,7);
bar(27,30+i,30,100+i);
setfillstyle(1,9);
bar(32,40+i,35,90+i);
setfillstyle(1,14);
bar(37,50+i,40,80+i);
setfillstyle(1,4);
bar(42,60+i,45,70+i);

delay(20);
setfillstyle(SOLID_FILL,0);
bar(20,20+i,25,110+i);
bar(27,30+i,30,100+i);
bar(32,40+i,35,90+i);
bar(37,50+i,40,80+i);
bar(42,60+i,45,70+i);
if(kbhit())
{
int ch=getch();
if(ch==27)
{
closegraph();
exit(0);
}
if(ch==32 && m==0)
{
shoot();
}
}
}
i=0;j=300;
goto a;
}

main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
maxx=getmaxx();
maxy=getmaxy();
welcome();
branch();
leaves(0,-25);
man();
tree();
setfillstyle(1,GREEN);
bar(maxx-10,maxy-200,maxx,maxy);
line(400,200,450,200);
for(ll=15;ll<=150;ll+=15)
{
outtextxy(550,40+ll,"_______");
outtextxy(600,44+ll,"<");
}
setcolor(LIGHTGRAY);
outtextxy(470,15,"Press `Esc' to Quit");
outtextxy(230,40,"Total Score:");
gcvt(score,4,a);
outtextxy(330,40,a);
dartboard();
return 0;
}

tree()
{
int x,y,ff;
setcolor(2);
setfillstyle(SOLID_FILL,2);
rectangle(10,10,maxx-10,maxy-10);
floodfill(2,2,2);
for(x=0;x<maxx;x+=100)
{
arc(x,maxy-10,0,50,50);
arc(x+6,maxy-6,0,60,50);
arc(x+12,maxy-10,130,180,50);
arc(x+6,maxy-6,120,180,50);
}
for(y=0;y<maxx;y+=200)
{
line(y+100,maxy-10,y+90,maxy-60);
line(y+105,maxy-10,y+90,maxy-60);
arc(y+160,maxy-10,110,180,50);
arc(y+154,maxy-6,120,180,50);
}
for(ff=0;ff<maxx;ff+=100)
{
floodfill(ff+52,maxy-20,2);
floodfill(ff+62,maxy-20,2);
if(ff%200==0)
{
floodfill(ff+101,maxy-20,2);
floodfill(ff+107,maxy-20,2);
}
}
return 0;
}

man()
{
int xp=10,yp=19;
setcolor(7);
arc(503,198,145,225,92);
arc(504,198,145,225,92);
arc(505,198,145,225,92);
line(xp+451,yp+140,xp+462,yp+144);
line(xp+462,yp+144,xp+474,yp+145);
line(xp+474,yp+145,xp+481,yp+143);
line(xp+481,yp+143,xp+491,yp+141);
line(xp+491,yp+141,xp+480,yp+132);
line(xp+480,yp+132,xp+475,yp+139);
line(xp+475,yp+139,xp+471,yp+132);
line(xp+471,yp+132,xp+471,yp+132);
line(xp+471,yp+132,xp+450,yp+139);
line(xp+450,yp+138,xp+458,yp+129);
line(xp+458,yp+129,xp+470,yp+124);
line(xp+470,yp+124,xp+475,yp+122);
line(xp+475,yp+122,xp+480,yp+123);
line(xp+480,yp+123,xp+480,yp+120);
line(xp+480,yp+120,xp+487,yp+120);
line(xp+487,yp+120,xp+481,yp+123);
line(xp+481,yp+123,xp+470,yp+129);
line(xp+470,yp+129,xp+467,yp+134);
line(xp+482,yp+123,xp+488,yp+124);
line(xp+488,yp+124,xp+497,yp+124);
line(xp+497,yp+124,xp+488,yp+129);
line(xp+488,yp+129,xp+493,yp+131);
line(xp+493,yp+131,xp+482,yp+131);
line(xp+486,yp+131,xp+488,yp+138);
line(xp+487,yp+143,xp+486,yp+158);
line(xp+486,yp+158,xp+482,yp+166);
line(xp+482,yp+166,xp+474,yp+169);
line(xp+474,yp+169,xp+474,yp+168);
line(xp+474,yp+168,xp+476,yp+164);
line(xp+478,yp+164,xp+481,yp+162);
line(xp+481,yp+162,xp+481,yp+154);
line(xp+481,yp+154,xp+480,yp+152);
line(xp+480,yp+152,xp+476,yp+156);
line(xp+476,yp+156,xp+476,yp+149);
line(xp+476,yp+149,xp+473,yp+145);
line(xp+454,yp+140,xp+455,yp+153);
line(xp+455,yp+153,xp+451,yp+156);
line(xp+451,yp+156,xp+449,yp+158);
line(xp+449,yp+159,xp+449,yp+164);
line(xp+449,yp+164,xp+452,yp+173);
line(xp+452,yp+173,xp+457,yp+179);
line(xp+457,yp+179,xp+461,yp+178);
line(xp+461,yp+178,xp+466,yp+174);
line(xp+462,yp+177,xp+463,yp+182);
line(xp+474,yp+169,xp+470,yp+179);
line(xp+471,yp+179,xp+484,yp+179);
line(xp+484,yp+179,xp+480,yp+183);
line(xp+471,yp+178,xp+466,yp+182);
line(xp+468,yp+183,xp+473,yp+189);
line(xp+473,yp+189,xp+484,yp+189);
line(xp+484,yp+189,xp+479,yp+183);
line(xp+390,yp+181,xp+482,yp+183);
line(xp+460,yp+183,xp+463,yp+190);
line(xp+463,yp+190,xp+470,yp+186);
line(xp+462,yp+186,xp+458,yp+186);
line(xp+458,yp+186,xp+456,yp+198);
line(xp+456,yp+198,xp+463,yp+190);
line(xp+463,yp+190,xp+467,yp+200);
line(xp+467,yp+200,xp+476,yp+190);
line(xp+457,yp+190,xp+453,yp+193);
line(xp+453,yp+193,xp+450,yp+205);
line(xp+450,yp+205,xp+445,yp+228);
line(xp+445,yp+228,xp+441,yp+232);
line(xp+441,yp+232,xp+452,yp+234);
line(xp+452,yp+234,xp+462,yp+238);
line(xp+462,yp+238,xp+462,yp+238);
line(xp+462,yp+238,xp+475,yp+238);
line(xp+475,yp+238,xp+481,yp+233);
line(xp+481,yp+233,xp+480,yp+200);
line(xp+480,yp+200,xp+485,yp+200);
line(xp+485,yp+200,xp+498,yp+204);
line(xp+498,yp+204,xp+496,yp+199);
line(xp+496,yp+199,xp+501,yp+196);
line(xp+501,yp+195,xp+498,yp+192);
line(xp+498,yp+197,xp+510,yp+203);
line(xp+510,yp+203,xp+513,yp+195);
line(xp+498,yp+184,xp+514,yp+182);
line(xp+514,yp+182,xp+515,yp+186);
line(xp+496,yp+186,xp+521,yp+186);
line(xp+521,yp+186,xp+526,yp+191);
line(xp+526,yp+191,xp+521,yp+195);
line(xp+521,yp+195,xp+513,yp+195);
line(xp+513,yp+195,xp+495,yp+191);
line(xp+496,yp+190,xp+496,yp+194);
line(xp+496,yp+194,xp+489,yp+196);
line(xp+489,yp+196,xp+485,yp+194);
line(xp+485,yp+194,xp+483,yp+182);
line(xp+483,yp+182,xp+492,yp+182);
line(xp+492,yp+182,xp+492,yp+182);
line(xp+493,yp+182,xp+496,yp+187);
line(xp+493,yp+182,xp+499,yp+180);
line(xp+499,yp+180,xp+498,yp+184);
line(xp+486,yp+186,xp+491,yp+187);
line(xp+485,yp+191,xp+490,yp+191);
line(xp+488,yp+201,xp+485,yp+233);
line(xp+485,yp+233,xp+481,yp+233);
line(xp+442,yp+232,xp+442,yp+238);
line(xp+442,yp+238,xp+448,yp+242);
line(xp+449,yp+242,xp+457,yp+246);
line(xp+457,yp+246,xp+468,yp+245);
line(xp+469,yp+245,xp+479,yp+240);
line(xp+479,yp+240,xp+478,yp+237);
line(xp+479,yp+239,xp+485,yp+259);
line(xp+485,yp+259,xp+479,yp+264);
line(xp+479,yp+264,xp+477,yp+258);
line(xp+477,yp+258,xp+472,yp+259);
line(xp+472,yp+259,xp+472,yp+266);
line(xp+472,yp+266,xp+465,yp+266);
line(xp+465,yp+266,xp+464,yp+262);
line(xp+464,yp+262,xp+458,yp+262);
line(xp+458,yp+262,xp+458,yp+267);
line(xp+458,yp+267,xp+451,yp+267);
line(xp+451,yp+267,xp+451,yp+260);
line(xp+451,yp+260,xp+448,yp+260);
line(xp+448,yp+260,xp+443,yp+266);
line(xp+443,yp+266,xp+436,yp+262);
line(xp+436,yp+262,xp+442,yp+256);
line(xp+442,yp+256,xp+438,yp+255);
line(xp+438,yp+255,xp+433,yp+261);
line(xp+433,yp+261,xp+431,yp+256);
line(xp+431,yp+256,xp+436,yp+248);
line(xp+436,yp+248,xp+441,yp+238);
line(xp+440,yp+266,xp+440,yp+276);
line(xp+440,yp+276,xp+448,yp+295);
line(xp+450,yp+265,xp+449,yp+271);
line(xp+449,yp+271,xp+452,yp+278);
line(xp+452,yp+278,xp+452,yp+283);
line(xp+452,yp+283,xp+451,yp+291);
line(xp+451,yp+291,xp+452,yp+295);
line(xp+466,yp+266,xp+466,yp+276);
line(xp+466,yp+276,xp+475,yp+294);
line(xp+473,yp+265,xp+473,yp+270);
line(xp+473,yp+270,xp+476,yp+277);
line(xp+476,yp+277,xp+477,yp+289);
line(xp+477,yp+289,xp+478,yp+292);
line(xp+445,yp+295,xp+454,yp+295);
line(xp+454,yp+295,xp+457,yp+291);
line(xp+457,yp+291,xp+455,yp+299);
line(xp+455,yp+299,xp+457,yp+302);
line(xp+445,yp+295,xp+448,yp+299);
line(xp+449,yp+300,xp+435,yp+299);
line(xp+435,yp+299,xp+426,yp+302);
line(xp+426,yp+302,xp+422,yp+307);
line(xp+422,yp+307,xp+428,yp+309);
line(xp+428,yp+309,xp+444,yp+310);
line(xp+445,yp+310,xp+455,yp+307);
line(xp+472,yp+292,xp+477,yp+295);
line(xp+477,yp+295,xp+481,yp+290);
line(xp+481,yp+290,xp+483,yp+300);
line(xp+483,yp+300,xp+488,yp+306);
line(xp+488,yp+306,xp+479,yp+309);
line(xp+479,yp+309,xp+470,yp+309);
line(xp+470,yp+309,xp+454,yp+310);
line(xp+454,yp+310,xp+458,yp+302);
line(xp+458,yp+302,xp+464,yp+299);
line(xp+465,yp+299,xp+471,yp+299);
line(xp+471,yp+299,xp+478,yp+301);
line(xp+478,yp+301,xp+472,yp+293);
line(xp+409,yp+187,xp+458,yp+188);
line(xp+428,yp+188,xp+429,yp+202);
line(xp+429,yp+200,xp+439,yp+201);
line(xp+438,yp+189,xp+444,yp+193);
line(xp+444,yp+193,xp+438,yp+195);
line(xp+438,yp+195,xp+444,yp+199);
line(xp+444,yp+199,xp+437,yp+204);
line(xp+437,yp+204,xp+450,yp+204);
line(xp+409,yp+192,xp+428,yp+194);
line(xp+450,yp+233,xp+448,yp+242);
line(xp+460,yp+237,xp+459,yp+246);
line(xp+455,yp+235,xp+452,yp+242);
line(xp+458,yp+236,xp+457,yp+245);
line(xp+457,yp+196,xp+461,yp+210);
line(xp+461,yp+208,xp+465,yp+218);
line(xp+465,yp+218,xp+473,yp+225);
line(xp+473,yp+225,xp+480,yp+228);
line(xp+463,yp+192,xp+465,yp+206);
line(xp+465,yp+206,xp+472,yp+216);
line(xp+472,yp+216,xp+477,yp+219);
line(xp+477,yp+219,xp+480,yp+219);
line(xp+486,yp+180,xp+415,yp+126);
line(xp+482,yp+189,xp+428,yp+242);
line(xp+457,yp+145,xp+460,yp+150);
line(xp+464,yp+151,xp+471,yp+149);
line(xp+465,yp+152,xp+470,yp+153);
line(xp+460,yp+150,xp+456,yp+153);
line(xp+460,yp+151,xp+456,yp+150);
line(xp+458,yp+154,xp+454,yp+157);
line(xp+454,yp+157,xp+457,yp+161);
line(xp+453,yp+164,xp+456,yp+167);
line(xp+456,yp+167,xp+462,yp+167);
line(xp+462,yp+167,xp+467,yp+164);
line(xp+454,yp+163,xp+458,yp+163);
line(xp+458,yp+163,xp+467,yp+164);
line(xp+457,yp+170,xp+461,yp+170);
line(xp+409,yp+187,xp+411,yp+183);
line(xp+406,yp+186,xp+404,yp+185);
line(xp+404,yp+185,xp+399,yp+182);
line(xp+397,yp+183,xp+398,yp+198);
line(xp+398,yp+182,xp+404,yp+184);
line(xp+398,yp+196,xp+404,yp+196);
line(xp+404,yp+196,xp+406,yp+187);
line(xp+399,yp+188,xp+405,yp+188);
line(xp+401,yp+192,xp+401,yp+192);
line(xp+401,yp+192,xp+405,yp+192);
line(xp+405,yp+192,xp+415,yp+192);
line(xp+405,yp+185,xp+415,yp+185);
line(xp+465,yp+183,xp+462,yp+185);
line(xp+464,yp+150,xp+470,yp+145);
line(xp+476,yp+148,xp+470,yp+145);
line(xp+475,yp+164,xp+480,yp+162);

setfillstyle(1,4);
floodfill(xp+440,yp+300,7);
floodfill(xp+480,yp+300,7);
setfillstyle(1,6);
floodfill(xp+460,yp+255,7);
floodfill(xp+460,yp+220,7);
floodfill(xp+455,yp+200,7);
floodfill(xp+475,yp+200,7);
floodfill(xp+478,yp+190,7);
floodfill(xp+475,yp+190,7);
floodfill(xp+460,yp+188,7);
floodfill(xp+448,yp+195,7);
setfillstyle(1,4);
floodfill(xp+434,yp+190,7);
floodfill(xp+506,yp+196,7);
floodfill(xp+479,yp+221,7);
floodfill(xp+462,yp+199,7);
floodfill(xp+485,yp+206,7);
floodfill(xp+465,yp+128,7);
floodfill(xp+465,yp+138,7);
setfillstyle(1,13);
floodfill(xp+475,yp+188,7);
floodfill(xp+475,yp+182,7);
floodfill(xp+475,yp+128,7);
setfillstyle(1,10);
floodfill(xp+466,yp+158,7);
floodfill(xp+465,yp+166,7);
floodfill(xp+450,yp+290,7);
floodfill(xp+475,yp+290,7);
floodfill(xp+510,yp+190,7);
floodfill(xp+410,yp+189,7);
floodfill(xp+400,yp+189,7);
floodfill(xp+403,yp+189,7);
floodfill(xp+403,yp+186,7);
floodfill(xp+403,yp+195,7);
floodfill(xp+466,yp+184,7);
setcolor(6);
return 0;
}

branch()
{
int xp=0,yp=-25;
setcolor(BROWN);
line(xp+638,yp+337,xp+623,yp+332);
line(xp+623,yp+332,xp+601,yp+332);
line(xp+601,yp+332,xp+586,yp+340);
line(xp+586,yp+340,xp+571,yp+354);
line(xp+571,yp+354,xp+554,yp+358);
line(xp+554,yp+358,xp+534,yp+355);
line(xp+534,yp+355,xp+516,yp+346);
line(xp+516,yp+346,xp+495,yp+345);
line(xp+493,yp+344,xp+457,yp+347);
line(xp+457,yp+347,xp+432,yp+358);
line(xp+432,yp+358,xp+393,yp+369);
line(xp+393,yp+369,xp+364,yp+369);
line(xp+364,yp+369,xp+329,yp+357);
line(xp+329,yp+357,xp+316,yp+354);
line(xp+316,yp+354,xp+290,yp+357);
line(xp+290,yp+357,xp+285,yp+362);
line(xp+285,yp+362,xp+305,yp+360);
line(xp+305,yp+360,xp+323,yp+360);
line(xp+323,yp+360,xp+341,yp+370);
line(xp+347,yp+370,xp+332,yp+368);
line(xp+332,yp+368,xp+307,yp+376);
line(xp+307,yp+376,xp+275,yp+393);
line(xp+275,yp+393,xp+254,yp+393);
line(xp+254,yp+393,xp+233,yp+385);
line(xp+233,yp+385,xp+214,yp+381);
line(xp+214,yp+381,xp+232,yp+390);
line(xp+232,yp+390,xp+256,yp+402);
line(xp+256,yp+402,xp+301,yp+398);
line(xp+301,yp+398,xp+323,yp+379);
line(xp+323,yp+379,xp+350,yp+378);
line(xp+350,yp+378,xp+379,yp+384);
line(xp+379,yp+384,xp+399,yp+384);
line(xp+410,yp+378,xp+392,yp+387);
line(xp+391,yp+387,xp+361,yp+395);
line(xp+361,yp+395,xp+347,yp+416);
line(xp+347,yp+416,xp+347,yp+424);
line(xp+347,yp+424,xp+354,yp+409);
line(xp+354,yp+409,xp+367,yp+398);
line(xp+367,yp+398,xp+403,yp+389);
line(xp+403,yp+389,xp+428,yp+373);
line(xp+428,yp+373,xp+458,yp+363);
line(xp+458,yp+363,xp+493,yp+359);
line(xp+500,yp+355,xp+485,yp+363);
line(xp+485,yp+363,xp+460,yp+386);
line(xp+460,yp+386,xp+419,yp+405);
line(xp+419,yp+405,xp+450,yp+394);
line(xp+450,yp+394,xp+460,yp+393);
line(xp+460,yp+393,xp+447,yp+403);
line(xp+447,yp+403,xp+442,yp+417);
line(xp+442,yp+417,xp+445,yp+433);
line(xp+445,yp+433,xp+446,yp+417);
line(xp+446,yp+417,xp+457,yp+402);
line(xp+457,yp+402,xp+468,yp+396);
line(xp+468,yp+396,xp+473,yp+382);
line(xp+473,yp+382,xp+495,yp+361);
line(xp+495,yp+361,xp+514,yp+354);
line(xp+503,yp+359,xp+522,yp+365);
line(xp+522,yp+365,xp+547,yp+373);
line(xp+547,yp+373,xp+580,yp+374);
line(xp+580,yp+374,xp+593,yp+366);
line(xp+593,yp+366,xp+598,yp+358);
line(xp+598,yp+358,xp+623,yp+355);
line(xp+618,yp+356,xp+647,yp+371);
setcolor(BROWN);
setfillstyle(SOLID_FILL,BROWN);
line(xp+636,yp+335,xp+636,yp+365);
line(xp+496,yp+344,xp+489,yp+344);
line(xp+393,yp+368,xp+404,yp+368);
line(xp+513,yp+345,xp+523,yp+348);
line(xp+620,yp+357,xp+611,yp+353);
line(xp+635,yp+363,xp+639,yp+363);
line(xp+635,yp+363,xp+631,yp+364);
line(xp+638,yp+341,xp+630,yp+327);
setfillstyle(1,BROWN);
floodfill(xp+403,yp+374,BROWN);
return 0;
}

leaves(int xp, int yp)


{
setcolor(GREEN);
ellipse(xp+244,yp+411,0,360,2,14);
ellipse(xp+219,yp+398,0,360,3,16);
ellipse(xp+269,yp+382,0,360,4,10);
ellipse(xp+357,yp+424,0,360,8,3);
ellipse(xp+346,yp+431,0,360,2,10);
ellipse(xp+387,yp+402,0,360,4,6);
ellipse(xp+203,yp+379,0,360,12,2);
ellipse(xp+287,yp+370,0,360,2,8);
ellipse(xp+277,yp+360,0,360,9,2);
ellipse(xp+423,yp+415,0,360,3,12);
ellipse(xp+412,yp+401,0,360,10,3);
ellipse(xp+460,yp+431,0,360,16,4);
ellipse(xp+443,yp+441,0,360,2,11);
setfillstyle(SOLID_FILL,GREEN);
floodfill(xp+460,yp+430,GREEN);
floodfill(xp+444,yp+442,GREEN);
floodfill(xp+423,yp+417,GREEN);
floodfill(xp+413,yp+402,GREEN);
floodfill(xp+388,yp+404,GREEN);
floodfill(xp+360,yp+424,GREEN);
floodfill(xp+347,yp+432,GREEN);
floodfill(xp+245,yp+409,GREEN);
floodfill(xp+220,yp+398,GREEN);
floodfill(xp+200,yp+379,GREEN);
floodfill(xp+270,yp+381,GREEN);
floodfill(xp+288,yp+371,GREEN);
floodfill(xp+276,yp+359,GREEN);
return 0;
}

welcome()
{
tree();
setfillstyle(1,DARKGRAY);
bar(maxx/2-150,maxy/2-180,maxx/2+140,maxy/2+110);
setcolor(15);
outtextxy(maxx/2-80,maxy/2-150,"WELCOME TO ARCHERY");
outtextxy(maxx/2-120,maxy/2+80,"PRESS ANY KEY TO CONTINUE..!");
setcolor(2);
outtextxy(maxx/2-120,maxy/2-100,"Instructions:");
outtextxy(maxx/2-120,maxy/2-80,"You have 10 arrows");
outtextxy(maxx/2-120,maxy/2-60,"Points are as follows:-");
setcolor(RED);
outtextxy(maxx/2-100,maxy/2-40,"RED->100 pts.");
setcolor(YELLOW);
outtextxy(maxx/2-100,maxy/2-20,"YELLOW->70 pts.");
setcolor(BLUE);
outtextxy(maxx/2-100,maxy/2,"BLUE->50 pts.");
setcolor(CYAN);
outtextxy(maxx/2-100,maxy/2+20,"CYAN->40 pts.");
setcolor(BLACK);
outtextxy(maxx/2-100,maxy/2+40,"GREY->35 pts.");
getch();
setfillstyle(1,0);
setcolor(0);
bar(maxx/2-150,maxy/2-180,maxx/2+140,maxy/2+110);
return 0;
}

OUTPUT:

You might also like