好文档 - 专业文书写作范文服务资料分享网站

第二节数据类型

天下 分享 时间: 加入收藏 我要投稿 点赞

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

第二节数据类型

Themaindatatypesare:??????WeneedtheColorandDatetimetypesonlytofacilitatevisualizationandenteringthoseparametersthatwesetfromwithout.ThedataofColoran
推荐度:
点击下载文档文档为doc格式
0iuoj9l1ta3gzju6vsv034ka295j0v00cvj
领取福利

微信扫码领取福利

微信扫码分享