C ++自带的字符编码 [英] C++ own character-encoding

查看:126
本文介绍了C ++自带的字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以创建自己的字符编码/字符集表格并输入C ++?

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

例如,创建一个只包含以下字符的字符编码: / p>

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 |
+-----------+------+

像ASCII代码48-57和65-70,但9 + 1应为A,F + 1应为10.

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

推荐答案

感谢您的帮助。
也许我应该改写这个问题。

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

无论如何,在我的例子中,最好的解决方案是使用 bitset

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

这篇关于C ++自带的字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆