A Simple C programm



ഒരു ചെറിയ c  പ്രോഗ്രാം ..ഒന്ന് റണ്‍ ചെയ്തു നോക്ക്
കടപ്പാട് ബേസില്‍ bca 2അം വര്‍ഷ വിദ്യാര്‍ഥി bpc കോളേജ് പിറവം 
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<iostream.h>
union REGS in,out;
void main()
{
int gd=DETECT,gm,xm,ym,rx=0,ry=0,area,mx,my;
void far *buff,*buff1;
initgraph( &gd, &gm,"");
xm=getmaxx();
ym=getmaxy();
int bx=xm/2,by=ym/2;
setfillstyle(SOLID_FILL,YELLOW);
ellipse(bx,by,0,360,5,10);
floodfill(bx,by,WHITE);
area=imagesize(bx-15,by-15,bx+15,by+15);
buff=(char *)malloc(area);
getimage(bx-15,by-15,bx+15,by+15,buff);
cleardevice();
setfillstyle(SOLID_FILL,8);
ellipse(bx,by,0,360,20,8);
floodfill(bx,by,WHITE);
setfillstyle(SOLID_FILL,4);
ellipse(bx,by,180,0,19, 40);
floodfill(bx,by+30,WHITE);
area=imagesize(bx-22,by-22,bx+22,by+22);
buff1=(char *)malloc(area);
getimage(bx-22,by-10,bx+20,by+55,buff1);
cleardevice();
int set=0;
int count=0;
delay(3000);
int stage=1;
while(!kbhit())
{
st:
in.x.ax=3;
int86(51,&in,&out);
mx=out.x.cx;
my=out.x.dx;
if(set==0)
{
rx=rand()%xm;
set=1;
ry=0;
}
if(ry>ym)
{
ry=0;
set=0 ;
}
if(ry>ym-50)
{
if(rx>=mx-10&&rx<=mx+25)
{
count++;
sound(4000);
ry=ym;
}
else
{
while(!kbhit())
{
setcolor(rand()%20);
outtextxy((xm/2)-100,ym/2," game over");
sound(4000);
delay(200);
nosound();
setcolor(rand()%20);
outtextxy((xm/2)-100,ym/2," game over");
sound(2500);
delay(200);
nosound();
}
exit(0);
}
}
putimage(rx,ry,buff,XOR_PUT);
putimage(mx,ym-50,buff1,XOR_PUT);
delay(50);
putimage(rx,ry,buff,XOR_PUT);
putimage(mx,ym-50,buff1,XOR_PUT);
if(stage==1)
ry=ry+20;
if(stage==2)
ry=ry+25;
if(stage==3)
ry=ry+30;
if(stage==4)
ry=ry+35;
gotoxy(xm-65,2);
textbackground(GREEN);
cout<<"Current score : "<<count;
gotoxy(xm-65,2);
cout<<"\n";
gotoxy(xm-65,3);
cout<<"Stage : "<<stage;
nosound();
setfillstyle(9,1);
floodfill(100,0,WHITE);

if(count>5)

stage=2;
if(count>10)
stage=3;
if(count>15)
{
while(!kbhit())
{
setcolor(rand()%20);
outtextxy((xm/2)-100,ym/2," You Win");
}
}
}
getch();
}

Copyright @ 2013 കമ്പ്യൂട്ടര്‍ ജാലകം. Designed by Ebey John. .Ebey John