How to write number bigger than 9?

I used following command to write number and character on the graphic:
glutBitmapCharacter(GLUT_BITMAP_8_BY_13,c[i][j]+48); .

As you can see, if the value in c[i][j] is bigger than 9, it prints out those special characters and ABCD…

How can I write something like 100 or 15?


Try extracting each digit in the number
and printing out digit by digit.

You can do this by % the number by 10, and then divide by 10. Keep doing until you hit the digits mark.

Here is a routine I wrote to print text on the screen, with glutBitmapCharacter.


Sprint( 1,1,“12354ABCD”)

// I use this to put text on the screen
void Sprint( int x, int y, char *st)
int l,i;

l=strlen( st ); // see how many characters are in text string.
glRasterPos2i( x, y); // location to start printing text
for( i=0; i < l; i++)  // loop until i is greater then l
	glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, st[i]); // Print a character on the screen