定义新的基础类型 [英] Define new basis type

查看:88
本文介绍了定义新的基础类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我们如何定义新的基础类型?

我们知道这些类型之间的十六进制或十进制基数和转换,现在如何定义256基本类型的数据?

(例如保持ASCII值的A类型)

谢谢。

Hello.
How we can define a new basis types?
We know hexadecimal or decimal base and conversions between these types, now how is possible to define a 256 basis type of data?
(e.g. A type for keep the ASCII values)
Thanks.

推荐答案

''通常的方式'':定义 256 不同的(有序的)符号。
The ''usual way'': define 256 different (ordered) symbols.


在C ++中没有用于存储十六进制的单独类型或十进制值。这些整数值都存储在二进制类型中,如 int unsigned int ,并向外界展示它们可以通过printf或ltoa等库函数将它们转换为任意数字库。



C ++中已经有一个基本类型来存储ASCII字符: char



也许我不明白你的问题。请尝试改写它。
In C++ there are no separate types for storing hexadecimal or decimal value. Such integral values are all stored in binary types like int or unsigned int, and to show them to the outside world you can convert them into any arbitrary number base by library functions like printf or ltoa.

There is already a basic type in C++ to store ASCII characters: char.

Perhaps I didn''t understand your question. Please try to rephrase it.


这篇关于定义新的基础类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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