Int to Char

I'm trying to convert integers to char. Is there anyway to do this. I'm coding a game and am using rand to generate a range of numbers. After 10 these numbers have to be represented by letters. Thanks for your help.

Yes. Presumably you are converting the integers 0-9 to the characters '0' - '9' and want 10, for example to become 'A'? If so you can use the fact that characters are actually stored as integer codes so...

Code:

char x;
int i;
i = 10;
x = (char) i + ('A' - 10);

... will give A for 10, B for 11, C for 12 ... up to Z for 36. Beyond 36, you will get some other characters depending on the character set of you machine.

Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.