Program to draw a circle - c program, C/C++ Programming

Program to draw a circle:

int main(void)

{

   /* request auto detection */

   int gdriver = DETECT, gmode, errorcode;

   int midx, midy;

   int radius = 100;

 

   /* initialize graphics and local variables */

   initgraph(&gdriver, &gmode, "f:\\software\\tc\\bgi");

 

   /* read result of initialization */

   errorcode = graphresult();

   if (errorcode != grOk)  /* an error occurred */

   {

      printf("Graphics error: %s\n", grapherrormsg(errorcode));

      printf("Press any key to halt:");

      getch();

      exit(1); /* terminate with an error code */

   }

 

   midx = getmaxx() / 2;

   midy = getmaxy() / 2;

   setcolor(getmaxcolor());

 

   /* draw the circle */

   setcolor(RED);

   circle(midx, midy, radius);

   szetcolor(GREEN);

   floodfill(midx, midy, radius);

   /* clean up */

   getch();

   closegraph();

   return 0;

}

Posted Date: 10/19/2012 5:40:55 AM | Location : United States







Related Discussions:- Program to draw a circle - c program, Assignment Help, Ask Question on Program to draw a circle - c program, Get Answer, Expert's Help, Program to draw a circle - c program Discussions

Write discussion on Program to draw a circle - c program
Your posts are moderated
Related Questions
A: Use std::ios::binary. Some operating systems differentiate among text and binary modes. In text mode, end-of-line sequences and perhaps other things are translated; in binary

write a program to generate padovan sequence in c++

write an algorithm for multiplication of two sparse matrices using linked lists

steric in square

write a function that take as parameters an array of integer and its size and return the sum of its value

write a C++ program that performs the following tasks 1. prompts the user to enter two numbers 2. displays the divisors of each number and store the divisors of number 1 in A and t

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

A: A reference has to always refer to some object and, so, must always be initialized; pointers do not have such limits. A pointer may be reassigned to point to distinct objects wh

Question 1 Consider you have to find out average marks of 100 students in a class. Write simple program(s) using different iteration statements to accomplish it Question 2 Expla

How do one throw polymorphically?               A: Sometimes people write code such as: class MyExceptionBase { }; class MyExceptionDerived : public MyExceptionBase { };