hey people , i am a c++ biginner , i am self tought , this mean i have no teacher to help me .

now i arrived to graphics .
but i have got a small problem , i am programming with my laptop. my laptop is a mini laptop with windows 7 starter , it is compaq. so when ever i run a graphics program , the computer tell me that the program needs to run in full screan mode and the only options i have is to try again or cancel .i am using turbo c . as well as vc++ , but i cant run the graphics application in vc++

check , here is one of my graphics programs

#include<iostream.h> // tha main stream , you can remove it , it is not important , but i like it
#include<conio.h> // for getch();
#include<graphics.h> // for the graphics 

const int RAD=75; // set the radios of the circle
class ball
{
private:
int xco , yco;
int linecolor;
int fillcolor;
public:
ball()
{
xco = 0;
yco = 0;
linecolor = WHITE;
fillcolor = WHITE;
}
void set(int x, int y, int Lc, int fc)
{
xco = x;
yco = y;
linecolor = Lc;
fillcolor = fc;
}
void draw()
{
setcolor ( linecolor );
setlinestyle ( SOLID_LINE , 0 , THICK_WIDTH );
circle (xco , yco , RAD); // this is to draw the ball
setfillstyle (SOLID_FILL , fillcolor); // this is to set the style of filling the ball with colors
floodfill (xco , yco , linecolor); // this is to fill the ball with colors
}
};
void main()
{
int drive , mode;
drive = DETECT;
initgraph(&drive , &mode ,"\\tc\\bgi");
ball b1;
ball b2;
ball b3;

b1.set(320 , 150 , YELLOW , RED); //here we set the the 1st ball
b2.set(225 , 150 , YELLOW , GREEN); // here is the 2nd ball
b3.set(385 , 150 , YELLOW , BLUE);

b1.draw();
b2.draw();
b3.draw();
getch();
closegraph();
}#include<iostream.h> // tha main stream , you can remove it , it is not important , but i like it
#include<conio.h> // for getch();
#include<graphics.h> // for the graphics 

const int RAD=75; // set the radios of the circle
class ball
{
private:
int xco , yco;
int linecolor;
int fillcolor;
public:
ball()
{
xco = 0;
yco = 0;
linecolor = WHITE;
fillcolor = WHITE;
}
void set(int x, int y, int Lc, int fc)
{
xco = x;
yco = y;
linecolor = Lc;
fillcolor = fc;
}
void draw()
{
setcolor ( linecolor );
setlinestyle ( SOLID_LINE , 0 , THICK_WIDTH );
circle (xco , yco , RAD); // this is to draw the ball
setfillstyle (SOLID_FILL , fillcolor); // this is to set the style of filling the ball with colors
floodfill (xco , yco , linecolor); // this is to fill the ball with colors
}
};
void main()
{
int drive , mode;
drive = DETECT;
initgraph(&drive , &mode ,"\\tc\\bgi");
ball b1;
ball b2;
ball b3;

b1.set(320 , 150 , YELLOW , RED); //here we set the the 1st ball
b2.set(225 , 150 , YELLOW , GREEN); // here is the 2nd ball
b3.set(385 , 150 , YELLOW , BLUE);

b1.draw();
b2.draw();
b3.draw();
getch();
closegraph();
}

please tell me how to solve this proble (the graphics problem) and how to run my graphics in vc++ .
thanks

hey sorry , i posted the code 2 times . just read the code upto the

graphcolse() }

how to run my graphics in vc++

The short answer is that you can't. That graphics capability is a library that comes with (older) Borland compilers and cannot be used with other products. There is an older library for other compilers called WinBGIm that's supposed to emulate that Borland library, but I don't think it's in development any longer.

I don't do graphics (beyond GUI) but someone can probably suggest a good graphics library for you (along the lines of SDL or OpenGL).

I'm treading on thin ice as I don't know for sure, but I'm guessing modern Windows versions are intercepting or disregarding the lower level Borland calls from graphics.h.

What jonsca said is true, you cannot use graphics.h in Visual C++ or other IDE except Turbo C++. What you can do is, use that old WinBGIm library that jonsca mentioned along with Dev-C++(MinGw). Here is a tutorial on this topic: link. It has pretty much the same functionality as the original graphics.h header.
Also I could recommend using Turbo C++ through DosBox(It's a framework for running old 16-bit programs), especially if you're running Windows 7. Just remember not to hit Ctrl+F9, this closes DosBox, use Alt+R and Enter instead.

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.