Ball in Random Location

#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
void main()
{
clrscr();
int gd=DETECT,gm,x,y;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(11);
cout<<"\n\t\tBalls in Random Location";
cout<<"\n\t\t************************";
while(!kbhit())
{
setcolor(RED);
rectangle(40,90,560,400);
x=random(590);
y=random(390);
if(x>75&&y>100&&x<500&&y<400)
{
setcolor(random(5));
circle(x,y,10);
delay(100);
}
}
}

No comments:

Post a Comment

Thank you for using this blog.