-->

program to move a circle.

using turboc++
--------------------------------------------------------------------------
//moving a circle
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
clrscr();
int gdriver, gmode;    //variables declaration
gdriver=DETECT;        // detection of graphics driver
int move_location=20; //first location for circle to start
initgraph(&gdriver, &gmode, "c:\\tc\\BGI");
while(!kbhit()) //Checks for currently available keystrokes
{
circle(move_location,210,70);//draws circle
setcolor(BLUE);   //sets the color blue of circle
delay(100);       //delays of 1/10th of second
cleardevice();    //clears the previous screen/graphics
move_location++;
if(move_location>=600)
{
move_location=0;   //repeating the motion.
cleardevice();  //clears the graphics screen
}
}
getch();          //gets one character from user and closes the graphics.
closegraph();     //closes graphics.h
}

No comments:

Post a Comment