将整数添加到字符的ASCII值 由 孩,他爹发布于 2020-05-09 05:08:31 例如,我有一个char a,其ASCII值为97,我想在该ASCII值上加上10,但在这种情况下,再次将其另存为字母“ k”。我怎样才能做到这一点?我想举一个例子,但我没有
There is no difference between
97
and'a'
; they both produce the integer ninety-seven. The following two lines are equivalent:How do you add ten to a number? Using the addition operator or
+=
.The following would therefore produce
k
:Caveat: This answer presumes an ASCII-based machine.
'a'
wouldn't be equivalent to97
on an EBCDIC-based machine.只需添加10。