第一范文网 - 专业文章范例文档资料分享平台

第二节数据类型

来源:用户分享 时间:2025/10/25 23:10:44 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

The main data types are: ? ? ? ? ? ? We need the Color and Datetime types only to facilitate visualization and entering those parameters that we set from without. The data of Color and Datetime types are represented as integer values. We use implicit type transformation. The priority of types at a transformation in growing order is the following: int (bool,color,datetime); double; string; Before executing operations (except for the assignment operation) the data is transferred to a type of maximum precision, and before assignment operations - to the integer type. Integer constants Decimal: numbers from 0 to 9; Zero shouldn't be the first number. Examples: 12, 111, -956 1007 Hexadecimal: numbers from 0 to 9, letters a-f or A-F to represent the values 10-15; they start with 0x or 0X. Examples: 0x0A, 0x12, 0X12, 0x2f, 0xA3, 0Xa3, 0X7C7 Integer constants can assume values from -48 to 47. If a constant exceeds this range, the result isn't defined. Literal constants Any single character enclosed in single quotes or a hexadecimal ASCII-code of a character looking like '\\x10' is a character constant of integer type. Some characters like a single quote ('), double quote (\be represented as a combination of characters starting with a reverse slash (\\) according to the table below: line feed NL (LF) \\n horizontal tab HT \\t carriage return CR \\r reverse slash \\ \\\\ single quote ' \\' double quote \ hexadecimal ASCII-code hh \\xhh If a character different from those listed above follows the reverse slash, the result isn't defined. Examples: int a = 'A'; int b = '$'; int c = '?'; We can also use synonyms True and TRUE, False and FALSE. Examples: bool a = true; bool b = false; bool c = 1; Floating-point number constants Floating-point constants consist of an integer part, a dot (.) and a fractional part. The integer and the fractional parts are a succession of decimal numbers. An unimportant fractional part with the dot can be absent. Examples: double a = ; double b = ; double c = ; double d = 16; Floating-point constants can assume values from to . If a constant exceeds this range, the result isn't defined. String constants String constant is a succession of ASCII-code characters enclosed in double quotes: \ A string constant is an array of characters enclosed in quotes. It is of the string type. Each string constant, even if it is identical to another string constant, is saved in a separate memory space. If you need to insert a double quote (\into the line, you must place a reverse slash (\\) before it. You can insert any special character constants into the line if they have a reverse slash (\\) before them. The length of a string

搜索更多关于: 第二节数据类型 的文档
第二节数据类型.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0iuoj9l1ta3gzju6vsv034ka295j0v00cvj_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top