[try Beta version]
Not logged in

 
how do i display numbers in graphics mode?

Sep 4, 2016 at 1:57pm
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
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
outtextxy expects a string to output so why not just converting your number to a string?
Sep 6, 2016 at 3:30pm
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
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.