Program to change the foreground colors and draw circles on the screen
void main (int)
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
//Initializing graphics and local variables.
//Reading result of initialization.
//An error occurred.
printf("Graphics error occurred : %s \n",grapherrormsg(errorcode));
printf("Press any key to stop : ");
exit(1); //Terminate the program due to error.
/*Changing the foreground color.
Note : Press enter to exit the last screen as it is black and
it may appear as if the program has stopped running.*/
circle(20+(x*40),200,15);/*Changing x-coordinate by 50 each time so that
the circles do not overlap.*/
cleardevice(); //Clearing the screen in the graphics mode.
This graphics program changes the foreground colors on the screen gradually from white to black, in-turn drawing circles of that foreground color, using the 'setcolor' command.