News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

need to run simple graphic program

Started by r0x, August 16, 2010, 03:00:43 PM

Previous topic - Next topic

r0x

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 */

ollydbg

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.