944,175 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 7477
  • C++ RSS
Sep 29th, 2004
0

Need help setting up graphics

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Emmitt310 is offline Offline
10 posts
since Sep 2004
Sep 30th, 2004
0

Re: Need help setting up graphics

Quote originally posted by Emmitt310 ...
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
C++ Syntax (Toggle Plain Text)
  1. 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).
Reputation Points: 17
Solved Threads: 9
Posting Whiz in Training
frrossk is offline Offline
220 posts
since Sep 2004
Sep 30th, 2004
0

Re: Need help setting up graphics

Quote originally posted by Emmitt310 ...
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
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++.
Reputation Points: 10
Solved Threads: 2
Light Poster
letmec is offline Offline
33 posts
since Sep 2004
Nov 22nd, 2010
-1
Re: Need help setting up graphics
here is how i do it with turbo c++ 3.0 to draw a big circle on the screen.
C++ Syntax (Toggle Plain Text)
  1. #include"graphics.h"
  2.  
  3. #include"conio.h"
  4.  
  5. void main()
  6.  
  7. {
  8.  
  9. int gd=DETECT,gm;
  10.  
  11. initgraph(&gd, &gm, "c:/tc/bgi ");
  12.  
  13. circle(330,180,100);
  14.  
  15. getch()
  16.  
  17. closegraph();
  18.  
  19. restorecrtmode();
  20.  
  21. }
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
musawir is offline Offline
1 posts
since Nov 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: phone dialing program
Next Thread in C++ Forum Timeline: Need help writing this program!!! Help!!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC