Q:

setcolor function in c using graphics.h

0

setcolor function in c using graphics.h

Declaration: void setcolor(int color);

In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc. setcolor function is used to change the current drawing color.e.g. setcolor(RED) or setcolor(4) changes the current drawing color to RED. Remember that default drawing color is WHITE

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<graphics.h>
#include<conio.h>

main()
{
   int gd = DETECT, gm;
   initgraph(&gd,&gm,"C:\\TC\\BGI");

   circle(100,100,50);          /* drawn in white color */
   setcolor(RED);
   circle(200,200,50);          /* drawn in red color   */
       
   getch();
   closegraph();
   return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now