954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help setting up graphics

Hello, my name is Jonathan and I am a beginner programmer in my first year of studies. I am using a Turbo C++ editor and I'm trying to set up graphics. The problem is I'm not sure how. Here's how i was taught to set up graphics:

#include

int main()
{
int graphmode;
int graphdriver = DETECT;
intitgraph (&graphdriver, &graphmode, "C:\\BGI");

Im not sure if im doing the part in quotes right...

So... can anyone please find my error? The big thing is the compiler doesnt include graphics.h

Emmitt310
Newbie Poster
10 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 
The big thing is the compiler doesnt include graphics.h

Change the compiler...I guess you want to use the graphic mode for DOS; for this I was using the Borland C++ 3.1 compiler.
Then, you should write

intitgraph (&graphdriver, &graphmode, "C:\\BorlandC\BGI");



The part in the quotes must be the whole path to BGI folder (here, I assumed you installed Borland C on C: partition).

frrossk
Posting Whiz in Training
220 posts since Sep 2004
Reputation Points: 17
Solved Threads: 9
 

Hello, my name is Jonathan and I am a beginner programmer in my first year of studies. I am using a Turbo C++ editor and I'm trying to set up graphics. The problem is I'm not sure how. Here's how i was taught to set up graphics:

#include

int main() { int graphmode; int graphdriver = DETECT; intitgraph (&graphdriver, &graphmode, "C:\\BGI");

Im not sure if im doing the part in quotes right...

So... can anyone please find my error? The big thing is the compiler doesnt include graphics.h

I think you don't have graphics.h file in the correct directory. Usually it is located in the c:\\tc\\include dirct. Try to find this header file and locate it in the include diret. and in the initgraph() function write the whole path of BGI file int last argument.
like this for example
initgraph(&gd,&gm,"c:\\tc\\bgi");

first find the correct location of the files. If you donnot get the graphics.h then reinstall the turboc++.

letmec
Light Poster
33 posts since Sep 2004
Reputation Points: 10
Solved Threads: 2
 

here is how i do it with turbo c++ 3.0 to draw a big circle on the screen.

#include"graphics.h"

#include"conio.h"

void main()

{

int gd=DETECT,gm;

initgraph(&gd, &gm, "c:/tc/bgi ");

circle(330,180,100);

getch()

closegraph();

restorecrtmode();

}

it is pretty much simple and clear becarefull to provide the path to bgi files
where yours are. gm is for getting your screen resolution and gd for drivers.

musawir
Newbie Poster
1 post since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You