Search:
Forum
General C++ Programming
how do i display numbers in graphics mod
how do i display numbers in graphics mode?
Sep 4, 2016 at 1:57pm UTC
Roson
(20)
I'm currently making a program where i need to show the scores at the top right screen. But the thing is I'm using graphics and I cannot use outttextxy(x,y,number) . So, does anyone know a function to display scores in graphics mode???
thnx in advance
Sep 5, 2016 at 3:06pm UTC
popa6200
(48)
Can you be more specific why you cannot use outtextxy(), have you declared the environment before hand, what are you passing to the function?
Sep 5, 2016 at 3:29pm UTC
Thomas1965
(4571)
outtextxy expects a string to output so why not just converting your number to a string?
Sep 6, 2016 at 3:30pm UTC
Roson
(20)
Could you explain how to do that?
do you mean:
(assuming num = 32)
char temp_num[5] = num;
Is this how, because i completely don't understand that
@popa6200, outtextxy does not allow me to display a number
outtextxy(300,300, 7);
i have to do this:
outtextxy(300,300, "7");
Sep 6, 2016 at 3:46pm UTC
Thomas1965
(4571)
With itoa it's quite simple:
1
2
3
4
5
int
num = 32;
char
buffer[16] = {0}; itoa(num, buffer, 10); outtextxy(300, 300, buffer);
http://www.cplusplus.com/reference/cstdlib/itoa/
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs