Author Topic: need to run simple graphic program  (Read 20679 times)

Offline r0x

  • Single posting newcomer
  • *
  • Posts: 2
need to run simple graphic program
« on: August 16, 2010, 03:00:43 pm »
Hi there! How should I run this code? Which type of project do I need? Thanx!

/* Sample program to draw a circle*/
#include<graphics.h>
#include<conio.h>
main()
{
  int gd=DETECT,gm;
  initgraph(&gd,&gm,""); /* initialization of graphic mode */
  circle(150,150,100);
  getch();
  closegraph(); /* Restore orignal screen mode */
}
/* End of program */

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: need to run simple graphic program
« Reply #1 on: August 16, 2010, 03:07:51 pm »
Where did you copy these code snippet?
It seems it is for old BGI library of "Turbo C 2.0 " or "Borland C++" compiler. (It's an old compiler in the last centry :D)

So, I suggest you can
1, learn to use a new graphics library, like wxWidgets or others...
2, learn to use a BGI library for MINGW, see WinBGIm - Borland BGI emulation for MingW

Good luck!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.