Graphics in C Draw Circle 1

Graphics in C Draw Circle

  int driver, mod;
  driver = VGA;
  mod    = VGAHI;
  initgraph(&driver, &mod,"C:\\tc\\bgi");

Here is what the above code is Doing:
1. The first line #include is a header file in C that allows us to use graphics functions.
2. The next line main() is the main function where the program execution begins.
3. The next line int driver, mod; declares two integer variables driver and mod.
4. The next line driver = VGA; assigns the value VGA to the variable driver.
5. The next line mod = VGAHI; assigns the value VGAHI to the variable mod.
6. The next line initgraph(&driver, &mod,”C:\\tc\\bgi”); initializes the graphics system by loading a graphics driver from disk (or validating a registered driver) then putting the system into graphics mode.
7. The next line setcolor(RED); sets the current drawing color to red.
8. The next line circle(320,240,50); draws a circle with center at (320,240) and radius 50.
9. The next line getch(); waits for a key press.
10. The next line closegraph(); closes the graphics mode and deallocates all memory allocated by graphics system.

Similar Posts