The function identifier parameter type indicates the result type.
Abs integer and real absolute values are the same as independent variables.
Arctangent integer
Cos integer
Exponential integer, real number exponent real number type
Frac integer, real number fractional part real number
Int integer, real integer, partial real integer
Natural logarithm real number type
Pi real type of pi independent variable
Sine integer, real sine real number
Sqr integer and real square are the same independent variable.
Sqrt integer, real number square root real number type
For example: ABS (-4) = 4abs (-7.49) = 7.49arctan (0) = 0.0.
sin(pi)= 0.0 cos(pi)=- 1.0 frac(-3.7 1)=-0.7 1
int(-3.7 1)=-3.0 sqr(4)= 16 sqrt(4)= 2
2. Standard function
The function identifier parameter type indicates the result type.
Odd integers judge odd Boolean types.
Finding Forward Convergence Independent Variable by Pred Discrete Form
Succ discrete form with continuous same independent variables
For example: odd (1000) = false pred (2000) =1999 succ (2000) = 2001.
odd(3)= true pred(' x ')= ' w succ(' x ')= ' y '
3. Transfer function
The function identifier parameter type indicates the result type.
The character type of the independent variable corresponding to the chr byte
Sequential discrete independent variables correspond to long sequence numbers.
Rounding length of real number
Trunc real truncated integer length
For example: chr (66) =' b' ord ('a') = 65 round (-4.3) =-5 trunc (2.88) = 2.
4. Miscellaneous functions
The function identifier parameter type indicates the result type.
Random has no independent variable [0, 1, and random real numbers are real numbers.
Random word [0, a random integer between independent variables]
Randomize initializes the internal random number generator longint with no parameters.
Uppercase character type converts lowercase English letters into uppercase characters.
Downcase character type changes lowercase English letters to uppercase characters.
The runtime of SYSTEM TP, including commonly used standard functions and procedures, can be used directly in the program without using statements.
DOS has the functions of date, time, directory search and program execution.
CRT has the functions of screen mode control, extended keyboard code, color, window, sound and so on.
The printer supports printout operation.
GRAPH advanced graphics software package supports various graphics adapters.
GRAPH3 implements the graphics software package of TP3.0.
TURBO3 is compatible with TP3.0 source program.
Coverage for advanced coverage management
General procedures and functions of system units
ABS(X) F finds the absolute value of the variable.
ADDR(X) F variable address
APPEND(F) P Open an existing text file, point the file pointer to the end of the file, and prepare to add elements.
arc tangent
ASSIGN(F, C) P assigns the external file name represented by the string c to the document variable f.
Test whether the pointer or variable in the program is empty.
Read type file.
Write an untyped file.
BREAK P stops or ends the loop.
Change the current directory.
CHR(X) F looks for a character with an ASCII value of X.
Close (f) Close the file.
CONCAT(S 1, S2...S3) F string merging
Continue, p, continue the cycle.
COPY(S, POS, LEN) F returns a substring of a string.
cosine function
CSEG F returns the current value of the CS register.
DEC(X) F X:=X- 1
Delete a substring of a string.
Release a dynamic variable.
DSEG F returns the current value of the DS register.
EOF(F) F judges whether the file ends.
EOLN(F) F judges whether a line in the file type ends.
Delete an existing external file.
Exit p process aborted.
EXP(X) F is an exponential function based on e.
The current location of the FILEPOS(F) F file record
Number of FILESIZE(F) F file records
FILLCHAR(D, LEN, DATE) P fills a numeric value or character.
Clear the file cache.
Fract (x) f takes the fractional part of the real variable.
FREEMEM(P, I) P releases dynamic variables with variable length.
Get the current disk and current directory.
GETMEM(P, I) P allocates a dynamic variable with variable length and stores the block address in the pointer variable.
HALT P immediately stops program execution and returns to the T P editor or DOS.
HI(I) F returns the high byte of the variable.
INSERT(S, d, POS) F starts to insert a substring somewhere in the string.
INT F takes the integer part.
IORESULT F returns the result state of the last input/output operation.
LENGTH(S) F takes the length of the string.
Finding natural logarithm with LN(R) F
LO(I) F returns the low byte of the variable.
Returns the maximum memory space.
Returns the amount of available memory.
MKDIR(PATH) P creates a subdirectory.
Send it here quickly.
Create a new dynamic variable.
ODD(X) F judges whether the value of a variable is odd.
OFS(X) F terminal variable offset address
Find the ASCII value of a character.
Parameter F DOS parameter string length
PARAMSTR(N) F DOS parameter string
The value of πFπ
Pos(str 1, str2) f measures the starting position of another substring contained in a string.
Pred(x) f of precursor
Pointer assignment
Random f returns a random real number between 0 and 1.
Randomization p initializes the random number generator.
Read/readln(f, x) p read/input data.
Rename an external file.
Reset(f) p Open the file, point the file pointer to the beginning, and prepare to read the data.
Rewrite (f) p Open the file, point the file pointer to the beginning, and prepare to write data.
Delete a subdirectory.
Rounded approximate number (x) f real number
Runerror p stops the program from running.
Scrollto p Scroll to display part of the window.
Seek(f, n) p locates the file pointer on the nth file component of file F.
Seekrof(f) f is located at the end of the file.
Seekroln(f) f is at the end of the line.
Variable segment address
P Associate the input/output buffer with a text file.
sine function
Sizeof(x) f measures the size of a variable.
Sptr f returns the current value of the sp register.
Square feet
Square root of sqrt(x) f
Sseg f returns the current value of the ss register.
Str(i, s) f converts integers into strings.
Succ(X) f successor function
Swap(x) f swaps the high and low bytes of a variable.
Trunc(x) f truncates the decimal part of a real number.
Truncate (f) p Truncate the contents after the current pointer of the file.
Convert lowercase letters to uppercase letters.
Converts a string into a numeric value.
Writeln(f, x) p output
Common programs and functions of dos unit
Returns the current date of the system.
Returns the date and time of the last write.
Gettime p returns the current system time.
Packtime p converts the system date and time and encapsulates it into a 4-byte plastic format.
Set the current date of the system.
Setftime p writes a new system date and time, overwriting the last system date and time file written by the system.
Set the current system time.
Converts the system date and time to a recording format.
Returns the remaining free space of the specified disk.
Returns the total capacity of the specified disk.
Get/setverity p returns/sets the disk read-write flag in dos state.
Returns the full name of the function name.
Fsearch f looks for files in the directory.
Fsplit f divides file names into directories, file names and extensions.
Finds the first file name that matches the given attribute in the current directory or the specified directory.
Author: Wushan Feiyun February 7, 200516: 49 reply to this speech.
-
3 turbo pascal basic function flow and explanation
Returns the next matching file name.
Getfattr p returns the attributes of the file.
Setfattr p set file properties
Returns the value of an interrupt variable.
Intr p performs a soft interrupt.
Msdos p executes dos system call.
Setintvec p sets interrupt value.
Exec p executes a specific program segment through a specific command line.
Keep p interrupts the execution of the program, but it still resides in memory.
Swapvectors p exchanges all interrupt variable values with the current variable.
Dosexitcode f returns subroutine exit.
Dosversion f displays the dos version.
the crt unit
P link text file f and display crt.
Clears the characters after the current line cursor position.
Clrscr p clears the current window or screen, and the cursor returns to the upper left corner.
Delay (t) p Wait for t milliseconds.
Delline p clears all the contents of the line where the cursor is located.
Move the cursor somewhere on the screen.
Highvideo p selects high-brightness display characters.
Insline p Inserts an empty line at the current cursor position.
Keys determine the keyboard input state.
Low video p low brightness display characters
Normvideo p Select the normal text attribute to display characters from the cursor position.
No sound p Turn off the built-in speaker.
Readkey p waits for a character to be entered from the keyboard.
Sound (hz) p sounds at the frequency specified by hz.
Sets the background color of the text.
Sets the foreground color of the text.
Textmode p Select a specific text display mode.
Where x/y f returns the coordinate value of the current cursor position.
Window (x 1, y 1, x2, y2) p defines a text window on the screen.
Other units
Target program link
Execute (f) p Execute the target program.
Mark dynamic variables.
Release the dynamic variable area.
Srtinit p screen initialization
Chinese character screen mode conversion
Select the background color.
Graphcolormode p medium resolution color graphics mode, 320*200 colors.
Graphmode p medium resolution black and white graphics mode, 320*200 black and white.
Graphic window (x 1, y 1, x2, y2, color) p defines the graphic mode window.
Hire P high-resolution monochrome graphics mode, 640*200 black and white.
Hirescolor(color) p high-resolution color graphics mode, 640*200 colors.
Palette (color) p Medium resolution color graphic color group
Specifies the path to the overwrite file.
Draw (x 1, y 1, x2, y2, color) p draw a line.
Intr(n, m) p 8086 interrupt call
Plot(x, y, color) p Draw a point.
Random(integer) f generates a random integer.
Variable segment address
Colortable(c 1, c2, c3, c4) p redefines the color group.
Arc(x, y, radius, color) p Draw an arc.
Circle(x, y, radius, color) p Draw a circle.
Dump the pic (buffer, x 1, x2, y 1, y2) p screen to the screen.
P buffer dumps to the screen.
Getdotcolor(x, y) p read point
Fillscreen(color) p fills the screen.
Fillshape (x, y, fillcol, bordercol) p fills an area.
Common mathematical functions
Find the absolute value function abs(x)
Definition: function ABS (x): (same type as parameter);
Note: X can be an integer or a real number; The return value and x belong to the same type. Example:
Integer function int(x)
Definition: function int (x: real): real;
Note: X is a real number, and the return value is also a real number; Returns the integer part of x, that is, x is truncated (not rounded) Example:
Var R: true;
begin
r:= Int( 123.567); { 123.0 }
r:= Int(- 123.456); { - 123.0 }
End.
Trunc(x) relay function
Definition: function trunc (x: real): longint;
Note: x is a real expression. Trunc returns the integer part of an x of type Longint. Example:
begin
Writeln( 1.4,' become', trunc (1.4)); { 1 }
Writeln( 1.5,' become', trunc (1.5)); { 1 }
Writeln(- 1.4,' become', trunc (-1.4)); { - 1 }
Writeln(- 1.5,' become', trunc (-1.5)); { - 1 }
End.
Rounding function round(x)
Definition: function round (x: real): longint;
Note: x is a real expression. Round returns the rounded value of an x of type Longint. If the return value is beyond the expression range of Longint, an error will occur. Example:
begin
Writeln( 1.4,' round to', round (1.4)); { 1 }
Writeln( 1.5,' round to', round (1.5)); { 2 }
Writeln(- 1.4,' Round to', Round (-1.4)); { - 1 }
Writeln(- 1.5,' rounded', round (-1.5)); { -2 }
End.
Take the fractional function frac(x)
Definition: function frac (x: real): real;
Note: x is a real expression. The result returns the fractional part of x; That is Frac(X) = X-Int(_X). Example:
defined variable
R: true;
begin
r:= Frac( 123.456); { 0.456 }
r:= Frac(- 123.456); { -0.456 }
End.
Find the square root function sqrt(x) and the square function sqr(x)
Definition: square root: function sqrt (x: real): real;
Note: x is a real expression. Returns the square root of x of real number type. Square: function sqr (x): (same type as parameter);
Note: x is a real number or integer expression. The type of the return value is the same as that of X, and the size is the square of X, that is, X * X 。
Example:
begin
Writeln (the square of' 5 is', sqr (5)); { 25 }
Writeln (the square root of' 2 is', Sqrt(2.0));); { 1.4 14 }