C++ own character-encoding

点点圈 提交于 2019-12-24 22:29:53

问题


Is it possible to create an own character-encoding/ charset table and type in C++?

For example create a character-encoding with only the follow characters:

+-----------+------+
| character | code |
+-----------+------+
|     0     | 0000 |
|     1     | 0001 |
|     2     | 0010 |
|     3     | 0011 |
|     4     | 0100 |
|     5     | 0101 |
|     6     | 0110 |
|     7     | 0111 |
|     8     | 1000 |
|     9     | 1001 |
|     A     | 1010 |
|     B     | 1011 |
|     C     | 1100 |
|     D     | 1101 |
|     E     | 1110 |
|     F     | 1111 |
+-----------+------+

Like the ASCII Codes 48-57 and 65-70 but 9+1 should be A and F+1 should be 10.


回答1:


Thanks for your help. Maybe I should rephrase the question.

Whatever, in my case the best solution was to use a bitset.



来源:https://stackoverflow.com/questions/22268804/c-own-character-encoding

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