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 <graphics.h>

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

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).

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 <graphics.h>

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 includegraphics.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++.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.