c++ - Convert an int to ascii character - Stack Overflow

c++ - Convert an int to ascii character - Stack Overflow

瀏覽:1040
日期:2025-11-19
int i=5; char c = 'A'-1 + i; // c is now 'E', the 5th letter. Note that because in C/Ascii, A is considered the 0th letter ... Note that because in C/Ascii, A is considered the 0th letter of the alphabet, I do a minus-1 to compensate for the normally unde...看更多