Required knowledge of standard data types and built-in functions

Source: Internet
Author: User
Tags natural logarithm

I. Real Integer type

Real Type: value range: number of characters in a row: Number of valid digits
Real: 2.9e-39 .. 1.7e38: 6: 11 .. 12
Single: 1.5e-45 .. 3.4e38: 4: 7 .. 8
Double: 5.0e-324 .. 1.7e308: 8: 15 .. 16
Extended: 3.4e-4951 .. 1.1e4932: 10: 19 .. 20
Comp:-2 ** 63 + 1 .. 2 ** 63-.. 20

Integer: value range: number of occupied nodes: Format
Signed INT:-128 .. 127: 1: 8 digits
Integer:-32768 .. 32767: 2: 16 digits with symbols
Longint:-2147483648 .. 2147483647: 4: 32-Bit Signed
Byte: 0 .. 255: 1: 8-bit unsigned
Word: 0 .. 65535: 2: Unsigned 16-bit
Longword: 0 .. 4294967295: 4
CARDINAL: either word, longword or qword: Size 2/4/8
Int64:-9223372036854775808 .. 9223372036854775807: 8
Qword: 0 .. 18446744073709551615: 8

Ii. Common Pascal built-in functions and processes

Standard Constant False, maxint, true, maxlongint, Pi
Standard Boolean, Char, real, integer, longint, and so on
Standard Functions abs, arctan, CHR, cos, eof, eoln, exp, LN, Odd, ORD, Pred, round, sin, sqr, SQRT, succ, trunc
Standard Process dispose, get, new, pack, page, put, read, readln, reset, rewrite, unpack, write, writeln
Standard file input, output

(1) the independent variable must be a standard integer function:
(A) frontend function: PRED (X). The result type of the function is integer, for example, PRED (4) = 3.
(B) Successor function: succ (X). The result type of the function is integer, for example, succ (4) = 5.
(C) Odd Function: Odd (X). The result is boolean. For example, odd (13) = true
(D) character function: In CHR (x), X indicates the ASCII code, and the function result is in character type. For example, CHR (65) = 'A'
(2) Standard Functions Whose independent variables are INTEGER (or real) but whose value types are real;
(A) square root function: SQRT (X)
(B) integer function: int (x) integer, for example, INT (3.85) = 3.0
(C) Fractional Function: frac (X)
(D) sine function: sin (X)
(E) cosine function: cos (X)
(F) arctangent function: arctan (x), unit: radian
There is no tangent function in Pascal, which is replaced by sin (X)/cos (X ).
(G) exponential function: exp (x), that is, evaluate ex
(H) logarithm function: ln (x), that is, finding the natural logarithm logex of X
Power computation requires xy = eylnx, fill xy = exp (y * ln (X)
Note: In freepascal, the power representation is xy = power (x, y) or XY = x ** y.
(I) random function: Random (X: Word). If there is no X, the random decimal places between the function values [0, 1). If there is X and it is of the Word type, the function value is a random integer between [0, x. Add the randomize statement.
(J) circumference rate function Pi = 3.1415926536
(3) the independent variable is an integer (or real), but the function value type is the same as the standard function of X.
(A) ABS (x): absolute value function, for example, ABS (-2) = 2 ABS (-2.0) = 2.20.000000e + 00
(B) sqr (x): Square functions such as: sqr (4) = 16 sqr (4.0) = 1.6000000000e + 01
(4) Standard Functions Whose independent variables are INTEGER (or real) but whose function value type is Integer
(A) trunc (x): returns an integer, for example, trunc (3.85) = 3.
(B) Round (x): rounding, for example, round (2.8) = 3 round (-2.8) =-3
(5) Add 1 function: Inc (x) for example: Inc (5) = 6, Inc (5, 8) = 13
(6) subtraction 1 function Dec (x) for example: Dec (5) = 4 Dec 5, 3) = 2

File functions:
(1) When EOF (F) or seekeof (f) is not read to the end of the file "CHR (26)" or "Ctrl + z", the function value is false; when the end of the file is read, the function value is true;
(2) When eoln (F) or seekeolf (f) does not read the row Terminator "CHR (13)", the function value is false. When the row terminator or file Terminator is read, the function value is true;

Character Functions
(1) convert lowercase letters to uppercase letters upcase ('x'), for example, upcase ('A') = 'A'
(2) Pred function: PRED ('x'). The result is a forward type, for example, PRED ('4') = '3'
(3) Successor function: succ ('x'). The function result is of the struct type, for example, succ ('A') = 'B'
(4) ordinal number function: ord ('x'). The function result is an integer and the ASCII code corresponding to the character is obtained, for example, ord ('A') = 65.
(5) character function: CHR (x), X is an integer, and the function result is a string type. The ASCII Code corresponds to the character, for example, CHR (65) = 'A'

String Functions
(1) length Length
Definition: function length (S: string): integer;
(2) copy a substring
Definition: function copy (S: string; index: integer; count: integer): string;
Note: S is a string expression. Index and count are integer expressions. Copy returns a substring starting from index in S with Count characters.
(3) Insert sub-string insert
Definition: procedure insert (Source: string; var S: string; index: integer );
Note: source is a string expression. S is a string type variable of any length. Index is an integer expression. Insert the source into the index in S. If the length of the result string is greater than 255, the characters After 255 will be deleted.
(4) Delete a substring
Definition: Procedure Delete (var s: string; index: integer; count: integer );
Note: S is a string type variable. Index and countare are integer expressions. Delete deletes the Count characters starting from index in S. If the index is greater than the length of S, no characters are deleted. If the count is greater than the actual number of characters starting from index in S, the actual number of characters is deleted.
(5) convert string to numeric Val
Definition: Procedure Val (S; var V; var code: integer );
Here: S is a string type variable consisting of a series of numeric characters ;. V is an integer or a real variable; Code is an integer variable.
Note: Val converts s to its numerical form.
(6) convert the value into a string Str
Definition: Procedure STR (X [: width [: decimals]; var S: string); Note: Convert the value x into a string.
(7) obtain the starting position of the substring POS
Definition: function pos (substr: string; s: string): byte;
Note: substr and S string expression. Pos searches for substr in S and returns an integer value. This value is the position of the first character of substr in S. If substr is not found in S, POS returns 0.
(8) fully connected and connected characters
Definition: operator plus sign + concatenates two strings.
(9) string compression space concatenation-
Definition: Operator minus sign-remove the space at the end of the first string and join the two strings together.
(10) Fill in the array in batches with the initial values, fillchar (x, sizeof (x), 0), and fill 0 in the X array. sizeof (x) indicates the number of filled items.

3. Three important exit statements
Halt ends the program and returns to the Operating System
Exit ends the process or function and returns the call place (the same as the halt in the main program)
Break is the loop statement used to exit it (continue is to continue the current loop)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.