944,218 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 22339
  • C++ RSS
Feb 23rd, 2007
0

using Graphic.h

Expand Post »
hi,

hav jsut started with learnin c++ programmin, am using the dev c++ compiler(if u knw a better one plz tell me)...i just learnt basic graphics using the library graphics.h. I hav heard its a very old library but i dont knw of any other one's, so plz guide me as to which library should i use.

i made an XnO game(without any graphics). now i want to incorporate graphics into it. Using graphics.h i created an intro screen. Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it

used :-

outtextxy(13,13,a) - but its givin the below error


invalid conversion from `char' to `char*'

how do i correct this??
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
abhijit11 is offline Offline
2 posts
since Feb 2007
Feb 23rd, 2007
0

Re: using Graphic.h

graphics.h is a Borland-specific header file and not supported by any other compiler. When you write Windows programs you must use win32 api graphics functions, which are completly different than those you learned with graphics.h.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,966 posts
since Aug 2005
Feb 23rd, 2007
0

Re: using Graphic.h

Click to Expand / Collapse  Quote originally posted by abhijit11 ...
hi,

Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it

used :-

I think it would be.

outtextxy(13,13,a) - but its givin the below error
I think it might be.

outtextxy(13,13,"a")

Or you can do

moveto(13,13);
outtext(a);

Also, if you plan on printing out integers in graphics mode, they need to be converted into a string
Last edited by Colin Mac; Feb 23rd, 2007 at 12:09 pm.
Reputation Points: 78
Solved Threads: 22
Posting Whiz
Colin Mac is offline Offline
327 posts
since Sep 2006
Feb 23rd, 2007
0

Re: using Graphic.h

dev c++ compiler does not support any of the functions in graphics.h. You need more than just a .h file -- you will also need a *.lib library file which dev c++ does not support. So even if you get your program to compile it will not link due to lack of libraries.

If you really want to use functions in graphics.h then you have a couple options: (1) use old version of Turbo C/C++ or (2) Upgrade to newest version of Turbo C (I don't know if that version supports graphics.h or not, I doubt it because I think Borland made a 32-bit compiler out of it and graphic.h was for 16-bit MS-DOS operating system)
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,966 posts
since Aug 2005
Feb 23rd, 2007
0

Re: using Graphic.h

Well, Borland BGI is available till version 5 of Borland C++ Builder and available with every turbo c++(except the latest 2006 version).

BGI is crap and there is no guarantee that your current code compiles with current dev c++ compiler.

You should rather use system API and DirectX and OpenGL whiich are. I dont have much idea of all these things, but these are most popular.

If you want to use bgi, you can get turbo c++(an older version) for free from borland.
Reputation Points: 85
Solved Threads: 42
Nearly a Posting Virtuoso
vishesh is offline Offline
1,362 posts
since Oct 2006
Feb 24th, 2007
0

Re: using Graphic.h

dev c++ compiler does not support any of the functions in graphics.h. You need more than just a .h file -- you will also need a *.lib library file which dev c++ does not support. So even if you get your program to compile it will not link due to lack of libraries.

If you really want to use functions in graphics.h then you have a couple options: (1) use old version of Turbo C/C++ or (2) Upgrade to newest version of Turbo C (I don't know if that version supports graphics.h or not, I doubt it because I think Borland made a 32-bit compiler out of it and graphic.h was for 16-bit MS-DOS operating system)

yes i knw tat dev c++ compiler in its basic form does not support graphics.h but they have the option where if the .h file is added and the .lib files also included graphics.h works in it...

ok...am downloading turbo c++ and shifting to it...thx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
abhijit11 is offline Offline
2 posts
since Feb 2007
Feb 24th, 2007
0

Re: using Graphic.h

hey, how bout if u try to make it outtextxy(13,13,"a") instead......this function, as far as i know doesn't work without quotes.......
Reputation Points: 9
Solved Threads: 1
Newbie Poster
kansmish82 is offline Offline
10 posts
since Feb 2007
Feb 24th, 2007
0

Re: using Graphic.h

Click to Expand / Collapse  Quote originally posted by kansmish82 ...
hey, how bout if u try to make it outtextxy(13,13,"a") instead......this function, as far as i know doesn't work without quotes.......
Click to Expand / Collapse  Quote originally posted by Colin Mac ...
I think it might be.
outtextxy(13,13,"a")
All you need to do is read his request:
Click to Expand / Collapse  Quote originally posted by abhijit11 ...
Now am trying to display something the user enters onto the graphics screen. like if am accepting his initial into 'a' and want to display it. How should i do it
'a' is a variable. It contains what the user typed in. You don't use double quotes around a variable if you want to display what was entered. abhijit11 used the function correctly -- unless he defined 'a' as a single character. But we don't know that.
Moderator
Reputation Points: 3280
Solved Threads: 897
Posting Sage
WaltP is offline Offline
7,753 posts
since May 2006
Feb 24th, 2007
0

Re: using Graphic.h

Click to Expand / Collapse  Quote originally posted by WaltP ...
All you need to do is read his request:

'a' is a variable. It contains what the user typed in. You don't use double quotes around a variable if you want to display what was entered. abhijit11 used the function correctly -- unless he defined 'a' as a single character. But we don't know that.
Oh well, the second half of my post would have worked if the OP hadn't.
Reputation Points: 78
Solved Threads: 22
Posting Whiz
Colin Mac is offline Offline
327 posts
since Sep 2006

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: array help
Next Thread in C++ Forum Timeline: Adding binary numbers





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


Follow us on Twitter


© 2011 DaniWeb® LLC