Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference between function and procedure in PASCAL language?
What is the difference between function and procedure in PASCAL language?
1. Arithmetic function

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.