How To Convert A Number To an ASCII Character?

后端 未结 6 1164
礼貌的吻别
礼貌的吻别 2020-12-17 09:45

I want to create an application where user would input a number and the program will throw back a character to the user.

Edit: How about vice versa, changing a ascii

6条回答
  •  天命终不由人
    2020-12-17 10:02

    To get ascii to a number, you would just cast your char value into an integer.

    char ascii = 'a'
    int value = (int)ascii
    

    Variable value will now have 97 which corresponds to the value of that ascii character

    (Use this link for reference) http://www.asciitable.com/index/asciifull.gif

提交回复
热议问题