Drawing circle <graphics.h>

Aug 15, 2013 at 9:42am
What's wrong with my code? I just want to make a simple circle with this code.. Please tell me what's wrong. It does not shows any error nor warnings but when I'm trying to run it, the command interpreter opens then immediately closes, in short nothing happens but before it closes, it shows in the windows command prompt "BGI Error Graphics not initialized".
I'm using Turbo C++. And don't tell me to use other C++ compilers and use other libraries instead of graphics.h because these are the ones that I really need to use for our project.

1
2
3
4
5
6
7
8
9
10
11
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"C:\TC\BGI");
circle(20,15,30);
getch();
closegraph();
}
Last edited on Aug 15, 2013 at 9:49am
Aug 15, 2013 at 9:58am
You have to use the following code in main() function

1
2
int gd=DETECT,gm;
initgraph(&gd,&gm,”c:\\tc\\bgi\\”);


Two '\'s
Last edited on Aug 15, 2013 at 10:02am
Aug 15, 2013 at 10:13am
its still the same :(
Aug 15, 2013 at 11:22am
Topic archived. No new replies allowed.