What does stripping off the ASCII template mean?

亡梦爱人 提交于 2019-12-02 04:36:59

As you noticed, operations are performed on ASCII values of entered characters. In assembly, if you read characters from keyboard, you really get their ASCII values in registers, so let's say you enter 2 and 3 and want to add them, then you are really adding 50+51. You have to subtract 48 first, from each entered character, because 48 is a value of 0 character in ASCII. I think this is called "stripping off the ASCII template". Then, if you want to display the result of calculation on the screen, you have to add 48 back to the result (only if entered character and the result is single digit, for bigger numbers it involves more operations). Howerer, this makes sense for characters 0-9. I don't know why would you want to make calculations on alphabet characters, like a and b in your example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!